summaryrefslogtreecommitdiff
path: root/service/src/com/android/telephony/imsmedia/lib
diff options
context:
space:
mode:
Diffstat (limited to 'service/src/com/android/telephony/imsmedia/lib')
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/include/MediaQualityThreshold.h9
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/MediaQualityThreshold.cpp22
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h3
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraphRtpTx.h1
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoSource.h2
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h10
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp7
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp6
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp17
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp7
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/nodes/IVideoSourceNode.cpp21
11 files changed, 90 insertions, 15 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/include/MediaQualityThreshold.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/include/MediaQualityThreshold.h
index ecb33980..d7b7ced3 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/include/MediaQualityThreshold.h
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/include/MediaQualityThreshold.h
@@ -58,6 +58,8 @@ public:
std::vector<int32_t> getRtpJitterMillis() const;
void setNotifyCurrentStatus(bool status);
bool getNotifyCurrentStatus() const;
+ void setVideoBitrateBps(int32_t bitrate);
+ int32_t getVideoBitrateBps() const;
private:
/** The timer in milliseconds for monitoring RTP inactivity */
@@ -85,6 +87,13 @@ private:
* of the current status.
*/
bool mNotifyCurrentStatus;
+
+ /**
+ * The receiving bitrate threshold in bps for video call. If it is not zero, bitrate
+ * notification event is triggered when the receiving frame bitrate is less than the
+ * threshold.
+ */
+ int mVideoBitrateBps;
};
} // namespace imsmedia
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/MediaQualityThreshold.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/MediaQualityThreshold.cpp
index f0ca1473..c6ecefdd 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/MediaQualityThreshold.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/config/src/MediaQualityThreshold.cpp
@@ -34,6 +34,7 @@ MediaQualityThreshold::MediaQualityThreshold()
mRtpPacketLossRate.clear();
mRtpJitterMillis.clear();
mNotifyCurrentStatus = false;
+ mVideoBitrateBps = 0;
}
MediaQualityThreshold::MediaQualityThreshold(const MediaQualityThreshold& threshold)
@@ -45,6 +46,7 @@ MediaQualityThreshold::MediaQualityThreshold(const MediaQualityThreshold& thresh
mRtpPacketLossRate = threshold.mRtpPacketLossRate;
mRtpJitterMillis = threshold.mRtpJitterMillis;
mNotifyCurrentStatus = threshold.mNotifyCurrentStatus;
+ mVideoBitrateBps = threshold.mVideoBitrateBps;
}
MediaQualityThreshold::~MediaQualityThreshold() {}
@@ -60,6 +62,7 @@ MediaQualityThreshold& MediaQualityThreshold::operator=(const MediaQualityThresh
mRtpPacketLossRate = threshold.mRtpPacketLossRate;
mRtpJitterMillis = threshold.mRtpJitterMillis;
mNotifyCurrentStatus = threshold.mNotifyCurrentStatus;
+ mVideoBitrateBps = threshold.mVideoBitrateBps;
}
return *this;
}
@@ -72,7 +75,8 @@ bool MediaQualityThreshold::operator==(const MediaQualityThreshold& threshold) c
mRtpPacketLossDurationMillis == threshold.mRtpPacketLossDurationMillis &&
mRtpPacketLossRate == threshold.mRtpPacketLossRate &&
mRtpJitterMillis == threshold.mRtpJitterMillis &&
- mNotifyCurrentStatus == threshold.mNotifyCurrentStatus);
+ mNotifyCurrentStatus == threshold.mNotifyCurrentStatus &&
+ mVideoBitrateBps == threshold.mVideoBitrateBps);
}
bool MediaQualityThreshold::operator!=(const MediaQualityThreshold& threshold) const
@@ -83,7 +87,8 @@ bool MediaQualityThreshold::operator!=(const MediaQualityThreshold& threshold) c
mRtpPacketLossDurationMillis != threshold.mRtpPacketLossDurationMillis ||
mRtpPacketLossRate != threshold.mRtpPacketLossRate ||
mRtpJitterMillis != threshold.mRtpJitterMillis ||
- mNotifyCurrentStatus != threshold.mNotifyCurrentStatus);
+ mNotifyCurrentStatus != threshold.mNotifyCurrentStatus ||
+ mVideoBitrateBps != threshold.mVideoBitrateBps);
}
status_t MediaQualityThreshold::writeToParcel(Parcel* out) const
@@ -113,6 +118,7 @@ status_t MediaQualityThreshold::writeToParcel(Parcel* out) const
}
out->writeInt32(mNotifyCurrentStatus ? 1 : 0);
+ out->writeInt32(mVideoBitrateBps);
return NO_ERROR;
}
@@ -149,7 +155,7 @@ status_t MediaQualityThreshold::readFromParcel(const Parcel* in)
int32_t value;
in->readInt32(&value);
value == 1 ? mNotifyCurrentStatus = true : mNotifyCurrentStatus = false;
-
+ in->readInt32(&mVideoBitrateBps);
return NO_ERROR;
}
@@ -223,6 +229,16 @@ bool MediaQualityThreshold::getNotifyCurrentStatus() const
return mNotifyCurrentStatus;
}
+void MediaQualityThreshold::setVideoBitrateBps(int32_t bitrate)
+{
+ mVideoBitrateBps = bitrate;
+}
+
+int32_t MediaQualityThreshold::getVideoBitrateBps() const
+{
+ return mVideoBitrateBps;
+}
+
} // namespace imsmedia
} // namespace telephony
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h
index 891513dd..75d70238 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/ImsMediaDefine.h
@@ -52,6 +52,7 @@ enum kImsMediaEventType
kImsMediaEventResolutionChanged,
kImsMediaEventNotifyVideoDataUsage,
kImsMediaEventNotifyRttReceived,
+ kImsMediaEventNotifyVideoLowestBitrate,
};
// Internal Request Event
@@ -331,7 +332,7 @@ enum ImsMediaVideoMsgResponse
kVideoPeerDimensionChanged,
kVideoRtpHeaderExtensionInd,
kVideoMediaInactivityInd,
- kVideoPacketLossInd,
+ kVideoBitrateInd,
kVideoDataUsageInd,
kVideoSessionClosed,
};
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraphRtpTx.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraphRtpTx.h
index 1255d194..0fd1104a 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraphRtpTx.h
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/VideoStreamGraphRtpTx.h
@@ -29,6 +29,7 @@ public:
virtual ImsMediaResult create(RtpConfig* config);
virtual ImsMediaResult update(RtpConfig* config);
virtual ImsMediaResult start();
+ virtual bool setMediaQualityThreshold(MediaQualityThreshold* threshold);
void setSurface(ANativeWindow* surface);
virtual bool OnEvent(int32_t type, uint64_t param1, uint64_t param2);
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoSource.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoSource.h
index 3bc63092..f3c6622e 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoSource.h
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/android/ImsMediaVideoSource.h
@@ -137,7 +137,7 @@ public:
*
* @param bitrate The bitrate in bps units
*/
- void changeBitrate(const uint32_t bitrate);
+ bool changeBitrate(const uint32_t bitrate);
/**
* @brief Request a new IDR frame to the codec output streaming
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h
index bcc43d5b..17acd172 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/video/nodes/IVideoSourceNode.h
@@ -46,6 +46,14 @@ public:
* @param window surface buffer to update
*/
void UpdateSurface(ANativeWindow* window);
+
+ /**
+ * @brief Set the bitrate threshold to notify the indication when the encoding video bitrate is
+ * less than the threshold values
+ *
+ * @param bitrate The video encoding bitrate in bps unit
+ */
+ void SetBitrateThreshold(int32_t bitrate);
// callback from ImsMediaVideoSource
virtual void OnUplinkEvent(uint8_t* pBitstream, uint32_t nSize, int64_t pstUsec, uint32_t flag);
virtual void OnEvent(int32_t type, int32_t param1, int32_t param2);
@@ -68,6 +76,8 @@ protected:
android::String8 mImagePath;
uint32_t mDeviceOrientation;
ANativeWindow* mWindow;
+ int32_t mMinBitrateThreshold;
+ bool mBitrateNotified;
};
#endif \ No newline at end of file
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp
index 9d98be37..a52db04a 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoManager.cpp
@@ -407,12 +407,7 @@ void VideoManager::ResponseHandler::processEvent(
// TODO : add implementation
break;
case kVideoMediaInactivityInd:
- parcel.writeInt32(event);
- parcel.writeInt32(static_cast<int>(paramA)); // type
- parcel.writeInt32(static_cast<int>(paramB)); // duration
- VideoManager::getInstance()->sendResponse(sessionId, parcel);
- break;
- case kVideoPacketLossInd:
+ case kVideoBitrateInd:
parcel.writeInt32(event);
parcel.writeInt32(static_cast<int>(paramA));
VideoManager::getInstance()->sendResponse(sessionId, parcel);
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp
index 074e37cf..ba43d0a0 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoSession.cpp
@@ -106,6 +106,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config)
if (mGraphRtpTx != nullptr)
{
+ mGraphRtpTx->setMediaQualityThreshold(&mThreshold);
ret = mGraphRtpTx->update(config);
if (ret != RESULT_SUCCESS)
@@ -135,6 +136,7 @@ ImsMediaResult VideoSession::startGraph(RtpConfig* config)
if (pConfig->getMediaDirection() == RtpConfig::MEDIA_DIRECTION_SEND_ONLY ||
pConfig->getMediaDirection() == RtpConfig::MEDIA_DIRECTION_SEND_RECEIVE)
{
+ mGraphRtpTx->setMediaQualityThreshold(&mThreshold);
ret = mGraphRtpTx->start();
}
}
@@ -265,6 +267,10 @@ void VideoSession::onEvent(int32_t type, uint64_t param1, uint64_t param2)
ImsMediaEventHandler::SendEvent(
"VIDEO_RESPONSE_EVENT", kVideoDataUsageInd, mSessionId, param1, param2);
break;
+ case kImsMediaEventNotifyVideoLowestBitrate:
+ ImsMediaEventHandler::SendEvent(
+ "VIDEO_RESPONSE_EVENT", kVideoBitrateInd, mSessionId, param1, param2);
+ break;
case kRequestVideoCvoUpdate:
case kRequestVideoBitrateChange:
case kRequestVideoIdrFrame:
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp
index 71a6f050..bc7c7dd0 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/VideoStreamGraphRtpTx.cpp
@@ -234,6 +234,23 @@ ImsMediaResult VideoStreamGraphRtpTx::start()
return RESULT_SUCCESS;
}
+bool VideoStreamGraphRtpTx::setMediaQualityThreshold(MediaQualityThreshold* threshold)
+{
+ if (threshold != nullptr)
+ {
+ BaseNode* node = findNode(kNodeIdVideoSource);
+
+ if (node != nullptr)
+ {
+ IVideoSourceNode* source = reinterpret_cast<IVideoSourceNode*>(node);
+ source->SetBitrateThreshold(threshold->getVideoBitrateBps());
+ return true;
+ }
+ }
+
+ return false;
+}
+
void VideoStreamGraphRtpTx::setSurface(ANativeWindow* surface)
{
IMLOGI1("[setSurface] state[%d]", mGraphState);
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp
index b8d69951..d5ae595c 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/video/android/ImsMediaVideoSource.cpp
@@ -442,14 +442,14 @@ void ImsMediaVideoSource::onCameraFrame(AImage* pImage)
}
}
-void ImsMediaVideoSource::changeBitrate(const uint32_t bitrate)
+bool ImsMediaVideoSource::changeBitrate(const uint32_t bitrate)
{
IMLOGD1("[changeBitrate] bitrate[%d]", bitrate);
std::lock_guard<std::mutex> guard(mMutex);
if (mStopped)
{
- return;
+ return false;
}
AMediaFormat* params = AMediaFormat_new();
@@ -459,7 +459,10 @@ void ImsMediaVideoSource::changeBitrate(const uint32_t bitrate)
if (status != AMEDIA_OK)
{
IMLOGE1("[changeBitrate] error[%d]", status);
+ return false;
}
+
+ return true;
}
void ImsMediaVideoSource::requestIdrFrame()
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: