summaryrefslogtreecommitdiff
path: root/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp
diff options
context:
space:
mode:
authorbodamnam <bodamnam@google.com>2023-02-03 09:02:51 +0000
committerbodamnam <bodamnam@google.com>2023-03-29 08:16:52 +0000
commit1b233d3498e685039b709fa89820e536b231688b (patch)
treeb1961b57aaf0f5320a9c06ef681d7401b8784375 /service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp
parent079ac227d80cbfe1ab72f4f03abf2a91ac283c3b (diff)
downloadImsMedia-1b233d3498e685039b709fa89820e536b231688b.tar.gz
Implementation of video downgrade opreration API
Add APIs to downgrade the video triggered by bitrate monitoring Bug: 224903790 Test: atest ImsMediaNativeTests, ImsMediaJavaUnitTests, verified with loopback mode using ImsMediaTestingApp, Video Call downgrade test with L_IR94_312601. Change-Id: I407e5b864bf8258ebb22bb47a1aba1eec871bc2c
Diffstat (limited to 'service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp')
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp
index 65b429e2..1ef9c10e 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp
@@ -45,6 +45,8 @@ IVideoSourceNode::IVideoSourceNode(BaseSessionCallback* callback) :
mImagePath = "";
mDeviceOrientation = 0;
mWindow = nullptr;
+ mMinBitrateThreshold = 0;
+ mBitrateNotified = false;
}
IVideoSourceNode::~IVideoSourceNode() {}
@@ -84,12 +86,13 @@ ImsMediaResult IVideoSourceNode::Start()
mVideoSource->SetSurface(mWindow);
- if (mVideoSource->Start() == false)
+ if (!mVideoSource->Start())
{
return RESULT_NOT_READY;
}
mVideoSource->SetDeviceOrientation(mDeviceOrientation);
+ mBitrateNotified = false;
}
mNodeState = kNodeStateRunning;
@@ -277,6 +280,12 @@ void IVideoSourceNode::OnUplinkEvent(uint8_t* data, uint32_t size, int64_t times
}
}
+void IVideoSourceNode::SetBitrateThreshold(int32_t bitrate)
+{
+ IMLOGD1("[SetBitrateThreshold] bitrate[%d]", bitrate);
+ mMinBitrateThreshold = bitrate;
+}
+
void IVideoSourceNode::OnEvent(int32_t type, int32_t param1, int32_t param2)
{
IMLOGD3("[OnEvent] type[%d], param1[%d], param2[%d]", type, param1, param2);
@@ -298,7 +307,15 @@ void IVideoSourceNode::OnEvent(int32_t type, int32_t param1, int32_t param2)
case kRequestVideoBitrateChange:
if (mVideoSource != nullptr)
{
- mVideoSource->changeBitrate(param1);
+ if (mVideoSource->changeBitrate(param1))
+ {
+ if (mMinBitrateThreshold != 0 && param1 <= mMinBitrateThreshold &&
+ mCallback != nullptr && !mBitrateNotified)
+ {
+ mCallback->SendEvent(kImsMediaEventNotifyVideoLowestBitrate, param1);
+ mBitrateNotified = true;
+ }
+ }
}
break;
case kRequestVideoIdrFrame: