summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbodamnam <bodamnam@google.com>2023-03-23 13:38:02 +0000
committerbodamnam <bodamnam@google.com>2023-04-05 06:44:45 +0000
commit4ecaf6596c9439bf5e40859cf0cc40e256b7aa22 (patch)
tree0abfe83ca2e70993d77fdabfe628b6f4a0986eba
parent982e54e3fea845dd9c853b8133c9092b4355edc6 (diff)
downloadImsMedia-4ecaf6596c9439bf5e40859cf0cc40e256b7aa22.tar.gz
Fix to handle empty redundant payload in RTT decoder
The current code could not recover lost packet from the redundant packets by the code skip the empty payload in TextRtpPayloadDecoderNode. Therefore, I change the below point to pass the empty redundant payload to recover the text payload when the packet is lost. 1) Modify TextRtpPayloadDecoder to send empty redundant payload to next node 2) Move the setting the flag in TextJitterBuffer from first frame received to the first frame processed. 3) Remove the code ignoring the empty frames in TextRendererNode Bug: 274881848 Test: Verified packet loss simulation in RTT call using ImsMediaTestingApp, atest ImsMediaNativeTests, Pass the TC LTE_BTR_5_9439. Change-Id: I09afff3eb288a0d0318eadcaa53966c0745931f9
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp14
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp14
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp88
3 files changed, 42 insertions, 74 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp
index beb1d015..9ed07c0a 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/TextJitterBuffer.cpp
@@ -32,11 +32,9 @@ void TextJitterBuffer::Reset()
}
void TextJitterBuffer::Add(ImsMediaSubType subtype, uint8_t* buffer, uint32_t size,
- uint32_t timestamp, bool mark, uint32_t seqNum, ImsMediaSubType dataType,
+ uint32_t timestamp, bool mark, uint32_t seqNum, ImsMediaSubType /*dataType*/,
uint32_t arrivalTime)
{
- (void)dataType;
-
IMLOGD_PACKET6(IM_PACKET_LOG_JITTER,
"[Add] seq[%u], mark[%u], TS[%u], size[%u], lastPlayedSeq[%u], arrivalTime[%u]", seqNum,
mark, timestamp, size, mLastPlayedSeqNum, arrivalTime);
@@ -64,11 +62,6 @@ void TextJitterBuffer::Add(ImsMediaSubType subtype, uint8_t* buffer, uint32_t si
if (mDataQueue.GetCount() == 0) // jitter buffer is empty
{
mDataQueue.Add(&currEntry);
-
- if (!mFirstFrameReceived)
- {
- mFirstFrameReceived = true;
- }
}
else
{
@@ -169,6 +162,11 @@ void TextJitterBuffer::Delete()
return;
}
+ if (!mFirstFrameReceived)
+ {
+ mFirstFrameReceived = true;
+ }
+
mLastPlayedSeqNum = pEntry->nSeqNum;
mLastPlayedTimestamp = pEntry->nTimestamp;
mDataQueue.Delete();
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp
index 628248cc..254081d1 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRendererNode.cpp
@@ -114,20 +114,6 @@ void TextRendererNode::ProcessData()
"[ProcessData] size[%u], TS[%u], mark[%u], seq[%u], last seq[%u]", size, timestamp,
mark, seq, mLastPlayedSeq);
- // ignore empty t.140
- if (size == 0)
- {
- mLastPlayedSeq = (uint16_t)seq;
- DeleteData();
- break;
- }
-
- if (data == nullptr)
- {
- IMLOGD0("[ProcessData] invalid data");
- break;
- }
-
if (mFirstFrameReceived)
{
// detect lost packet
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp
index 284311e2..901f88c6 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/text/nodes/TextRtpPayloadDecoderNode.cpp
@@ -118,10 +118,10 @@ void TextRtpPayloadDecoderNode::DecodeT140(uint8_t* data, uint32_t size, ImsMedi
if (subtype == MEDIASUBTYPE_BITSTREAM_T140 || subtype == MEDIASUBTYPE_BITSTREAM_T140_RED)
{
- std::list<uint32_t> lstTSOffset;
- std::list<uint32_t> lstLength;
- uint32_t nReadByte = 0;
- uint32_t nRedCount = 0;
+ std::list<uint32_t> listTimestampOffset;
+ std::list<uint32_t> listLength;
+ uint32_t readByte = 0;
+ uint16_t redundantCount = 0;
mBitReader.SetBuffer(data, size);
@@ -136,7 +136,6 @@ void TextRtpPayloadDecoderNode::DecodeT140(uint8_t* data, uint32_t size, ImsMedi
*/
// Primary Data Only
- // Red header + primary header = 5 byte
if (subtype == MEDIASUBTYPE_BITSTREAM_T140)
{
SendDataToRearNode(MEDIASUBTYPE_BITSTREAM_T140, data, size, timestamp, mark, seq);
@@ -144,69 +143,54 @@ void TextRtpPayloadDecoderNode::DecodeT140(uint8_t* data, uint32_t size, ImsMedi
}
// Redundant data included
- while (mBitReader.Read(1) == 1) // Rendundancy bit
+ while (mBitReader.Read(1) == 1) // redundant flag bit
{
- uint32_t nPT = mBitReader.Read(7); // T140 payload type
- uint32_t nTSOffset = mBitReader.Read(14);
- uint32_t nLen = mBitReader.Read(10);
+ uint32_t payloadType = mBitReader.Read(7); // T140 payload type
+ uint32_t timestampOffset = mBitReader.Read(14);
+ uint32_t length = mBitReader.Read(10);
- lstTSOffset.push_back(nTSOffset); // timestamp offset
- lstLength.push_back(nLen); // block length
+ listTimestampOffset.push_back(timestampOffset); // timestamp offset
+ listLength.push_back(length); // block length
- IMLOGD_PACKET3(IM_PACKET_LOG_PH, "[DecodeT140] nPT[%u], nTSOffset[%u], nLen[%u]", nPT,
- nTSOffset, nLen);
- nReadByte += 4;
- nRedCount++;
+ IMLOGD_PACKET3(IM_PACKET_LOG_PH, "[DecodeT140] PT[%u], TSOffset[%u], size[%u]",
+ payloadType, timestampOffset, length);
+ readByte += 4;
+ redundantCount++;
}
mBitReader.Read(7); // T140 payload type (111)
- nReadByte += 1;
+ readByte += 1;
// redundant data
- while (lstTSOffset.size() > 0)
+ while (listTimestampOffset.size() > 0)
{
- uint32_t nRedTimestamp = 0;
- uint32_t nRedLength = 0;
-
- nRedTimestamp = lstTSOffset.front();
- nRedLength = lstLength.front();
-
- if (nRedLength > 0)
- {
- uint32_t nRedSeqNum = 0;
- // here should compare mPayload size red length
- mBitReader.ReadByteBuffer(mPayload, nRedLength * 8);
- nReadByte += nRedLength;
-
- if (seq < nRedCount)
- {
- nRedSeqNum = seq + 0xffff - nRedCount; // round trip
- }
- else
- {
- nRedSeqNum = seq - nRedCount;
- }
-
- IMLOGD_PACKET3(IM_PACKET_LOG_PH,
- "[DecodeT140] nRedTimestamp[%u], nRedLength[%u], nRedSeqNum[%u]",
- timestamp - nRedTimestamp, nRedLength, nRedSeqNum);
- SendDataToRearNode(MEDIASUBTYPE_BITSTREAM_T140, mPayload, nRedLength,
- timestamp - nRedTimestamp, mark, nRedSeqNum);
- }
-
- nRedCount--;
- lstTSOffset.pop_front();
- lstLength.pop_front();
+ uint32_t redundantTimestamp = listTimestampOffset.front();
+ uint32_t redundantLength = listLength.front();
+
+ // read redundant payload
+ mBitReader.ReadByteBuffer(mPayload, redundantLength * 8);
+ readByte += redundantLength;
+
+ uint16_t redundantSeqNum = seq - redundantCount;
+
+ IMLOGD_PACKET3(IM_PACKET_LOG_PH, "[DecodeT140] red TS[%u], size[%u], seq[%u]",
+ timestamp - redundantTimestamp, redundantLength, redundantSeqNum);
+ SendDataToRearNode(MEDIASUBTYPE_BITSTREAM_T140, mPayload, redundantLength,
+ timestamp - redundantTimestamp, mark, redundantSeqNum);
+
+ redundantCount--;
+ listTimestampOffset.pop_front();
+ listLength.pop_front();
}
// primary data
- if (size - nReadByte > 0)
+ if (size - readByte > 0)
{
- mBitReader.ReadByteBuffer(mPayload, (size - nReadByte) * 8);
+ mBitReader.ReadByteBuffer(mPayload, (size - readByte) * 8);
}
SendDataToRearNode(
- MEDIASUBTYPE_BITSTREAM_T140, mPayload, (size - nReadByte), timestamp, mark, seq);
+ MEDIASUBTYPE_BITSTREAM_T140, mPayload, (size - readByte), timestamp, mark, seq);
}
else
{