summaryrefslogtreecommitdiff
path: root/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp')
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp
index bcd35a6d..cd4ca421 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/nodes/RtpEncoderNode.cpp
@@ -36,6 +36,7 @@ RtpEncoderNode::RtpEncoderNode(BaseSessionCallback* callback) :
mRtpTxDtmfPayload = 0;
mRtpRxDtmfPayload = 0;
mDtmfSamplingRate = 0;
+ mDtmfTimestamp = 0;
mCvoValue = CVO_DEFINE_NONE;
mRedundantLevel = 0;
mRedundantPayload = 0;
@@ -289,7 +290,7 @@ bool RtpEncoderNode::SetCvoExtension(const int64_t facing, const int64_t orienta
IMLOGD3("[SetCvoExtension] cvoValue[%d], facing[%ld], orientation[%ld]", mCvoValue, facing,
orientation);
- if (mCvoValue != -1)
+ if (mCvoValue > 0)
{
uint32_t rotation = 0;
uint32_t cameraId = 0;
@@ -337,6 +338,7 @@ bool RtpEncoderNode::SetCvoExtension(const int64_t facing, const int64_t orienta
extensionData[2] = 0; // padding
extensionData[3] = 0; // padding
+ mListRtpExtension.clear();
mListRtpExtension.push_back(RtpHeaderExtensionInfo(
RtpHeaderExtensionInfo::kBitPatternForOneByteHeader, 1, extensionData, 4));
return true;
@@ -445,18 +447,16 @@ bool RtpEncoderNode::ProcessAudioData(ImsMediaSubType subtype, uint8_t* data, ui
return false;
}
+ mMark ? mDtmfTimestamp = currentTimestamp : timeDiff = 0;
mPrevTimestamp = currentTimestamp;
timestampDiff = timeDiff * mSamplingRate;
- IMLOGD_PACKET2(IM_PACKET_LOG_RTP, "[ProcessAudioData] dtmf payload, size[%u], TS[%u]",
- size, currentTimestamp);
+ IMLOGD_PACKET3(IM_PACKET_LOG_RTP,
+ "[ProcessAudioData] dtmf payload, size[%u], TS[%u], diff[%d]", size,
+ mDtmfTimestamp, timestampDiff);
mRtpSession->SendRtpPacket(
- mRtpTxDtmfPayload, data, size, currentTimestamp, mMark, timestampDiff);
-
- if (mMark)
- {
- mMark = false;
- }
+ mRtpTxDtmfPayload, data, size, mDtmfTimestamp, mMark, timestampDiff);
+ mMark = false;
}
}
else // MEDIASUBTYPE_RTPPAYLOAD
@@ -480,8 +480,6 @@ bool RtpEncoderNode::ProcessAudioData(ImsMediaSubType subtype, uint8_t* data, ui
}
else if (timeDiff == 0)
{
- IMLOGD_PACKET2(IM_PACKET_LOG_RTP, "[ProcessAudioData] skip, prev[%u] curr[%u]",
- mPrevTimestamp, currentTimestamp);
return false;
}
else
@@ -496,8 +494,8 @@ bool RtpEncoderNode::ProcessAudioData(ImsMediaSubType subtype, uint8_t* data, ui
kCollectPacketInfo, kStreamRtpTx, reinterpret_cast<uint64_t>(packet));
timestampDiff = timeDiff * mSamplingRate;
- IMLOGD_PACKET3(IM_PACKET_LOG_RTP, "[ProcessAudioData] PayloadTx[%d], Size[%d], TS[%d]",
- mRtpPayloadTx, size, currentTimestamp);
+ IMLOGD_PACKET3(IM_PACKET_LOG_RTP, "[ProcessAudioData] size[%u], TS[%u], diff[%d]", size,
+ currentTimestamp, timestampDiff);
if (!mListRtpExtension.empty())
{
@@ -524,13 +522,23 @@ bool RtpEncoderNode::ProcessAudioData(ImsMediaSubType subtype, uint8_t* data, ui
void RtpEncoderNode::ProcessVideoData(
ImsMediaSubType subtype, uint8_t* data, uint32_t size, uint32_t timestamp, bool mark)
{
- IMLOGD_PACKET2(
- IM_PACKET_LOG_RTP, "[ProcessVideoData] nSize[%d], timestamp[%u]", size, timestamp);
+ IMLOGD_PACKET4(IM_PACKET_LOG_RTP, "[ProcessVideoData] subtype[%d], size[%d], TS[%u], mark[%d]",
+ subtype, size, timestamp, mark);
+
+#ifdef SIMULATE_VIDEO_CVO_UPDATE
+ const int64_t kCameraFacing = kCameraFacingFront;
+ static int64_t sDeviceOrientation = 0;
+ static int64_t sCount = 0;
+ if ((++sCount % 100) == 0)
+ {
+ SetCvoExtension(kCameraFacing, (sDeviceOrientation += 90) % 360);
+ }
+#endif
if (mCvoValue > 0 && mark && subtype == MEDIASUBTYPE_VIDEO_IDR_FRAME)
{
- mRtpSession->SendRtpPacket(
- mRtpPayloadTx, data, size, timestamp, mark, 0, &mListRtpExtension.front());
+ mRtpSession->SendRtpPacket(mRtpPayloadTx, data, size, timestamp, mark, 0,
+ mListRtpExtension.empty() ? nullptr : &mListRtpExtension.front());
}
else
{