From 1b233d3498e685039b709fa89820e536b231688b Mon Sep 17 00:00:00 2001 From: bodamnam Date: Fri, 3 Feb 2023 09:02:51 +0000 Subject: 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 --- .../core/video/nodes/IVideoSourceNode.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp') 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: -- cgit v1.2.3