summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp16
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h1
-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
5 files changed, 52 insertions, 81 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp
index 9e57dc90..08975fb9 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/nodes/IAudioPlayerNode.cpp
@@ -80,7 +80,6 @@ ImsMediaResult IAudioPlayerNode::ProcessStart()
IMLOGE0("[IAudioPlayer] Not able to start AudioPlayer");
}
- mFirstFrame = false;
mNodeState = kNodeStateRunning;
StartThread();
return RESULT_SUCCESS;
@@ -198,6 +197,7 @@ void* IAudioPlayerNode::run()
bool bMark = false;
uint32_t nSeqNum = 0;
uint64_t nNextTime = ImsMediaTimer::GetTimeInMicroSeconds();
+ bool isFirstFrameReceived = false;
while (true)
{
@@ -210,24 +210,28 @@ void* IAudioPlayerNode::run()
if (GetData(&subtype, &pData, &nDataSize, &nTimestamp, &bMark, &nSeqNum, &datatype) == true)
{
+ IMLOGD_PACKET2(IM_PACKET_LOG_AUDIO, "[run] write buffer size[%d], TS[%u]", nDataSize,
+ nTimestamp);
if (nDataSize != 0)
{
- IMLOGD_PACKET2(IM_PACKET_LOG_AUDIO, "[run] write buffer size[%d], TS[%u]",
- nDataSize, nTimestamp);
if (mAudioPlayer->onDataFrame(pData, nDataSize))
{
// send buffering complete message to client
- if (mFirstFrame == false)
+ if (isFirstFrameReceived == false)
{
mCallback->SendEvent(kImsMediaEventFirstPacketReceived,
reinterpret_cast<uint64_t>(new AudioConfig(*mConfig)));
- mFirstFrame = true;
+ isFirstFrameReceived = true;
}
}
}
-
DeleteData();
}
+ else if (isFirstFrameReceived)
+ {
+ IMLOGE0("[run] GetData returned 0 bytes");
+ mAudioPlayer->onDataFrame(nullptr, 0);
+ }
nNextTime += 20000;
uint64_t nCurrTime = ImsMediaTimer::GetTimeInMicroSeconds();
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h
index a041f25f..afea1a56 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/include/audio/nodes/IAudioPlayerNode.h
@@ -49,7 +49,6 @@ private:
int32_t mCodecType;
uint32_t mMode;
ImsMediaCondition mCondition;
- bool mFirstFrame;
int8_t mEvsChannelAwOffset;
kEvsBandwidth mEvsBandwidth;
int8_t mSamplingRate;
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
{