summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp
index 5b948204..64890329 100644
--- a/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp
+++ b/service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp
@@ -284,14 +284,20 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_
if (mDataQueue.GetCount() == 0)
{
- IMLOGD_PACKET0(IM_PACKET_LOG_JITTER, "[Get] wait - empty");
+ IMLOGD_PACKET0(IM_PACKET_LOG_JITTER, "[Get] fail - empty");
+
+ if (!mWaiting)
+ {
+ mCurrPlayingTS += FRAME_INTERVAL;
+ }
+
return false;
}
else if (mDataQueue.Get(&pEntry) && mWaiting)
{
uint32_t jitterDelay = currentTime - pEntry->arrivalTime;
- if (jitterDelay < (mCurrJitterBufferSize - 1) * FRAME_INTERVAL + ALLOWABLE_ERROR)
+ if (jitterDelay <= (mCurrJitterBufferSize - 1) * FRAME_INTERVAL)
{
if (psubtype)
*psubtype = MEDIASUBTYPE_UNDEFINED;
@@ -309,7 +315,6 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_
IMLOGD_PACKET4(IM_PACKET_LOG_JITTER,
"[Get] Wait - seq[%u], CurrJBSize[%u], delay[%u], QueueCount[%u]",
pEntry->nSeqNum, mCurrJitterBufferSize, jitterDelay, mDataQueue.GetCount());
- mCannotGetCount++;
return false;
}
else
@@ -321,6 +326,9 @@ bool AudioJitterBuffer::Get(ImsMediaSubType* psubtype, uint8_t** ppData, uint32_
}
else
{
+ IMLOGD_PACKET4(IM_PACKET_LOG_JITTER,
+ "[Get] Wait - seq[%u], CurrJBSize[%u], delay[%u], QueueCount[%u]",
+ pEntry->nSeqNum, mCurrJitterBufferSize, jitterDelay, mDataQueue.GetCount());
return false;
}
}
@@ -593,16 +601,26 @@ bool AudioJitterBuffer::Resync(uint32_t currentTime)
{
uint32_t timeDiff = currentTime - entry->arrivalTime;
- if (timeDiff > mCurrJitterBufferSize * FRAME_INTERVAL)
+ if (timeDiff > mCurrJitterBufferSize * FRAME_INTERVAL + ALLOWABLE_ERROR)
{
CollectRxRtpStatus(entry->nSeqNum, kRtpStatusDiscarded);
mDataQueue.Delete();
}
else
{
- // the first frame of voice term
- mCurrPlayingTS = entry->nTimestamp;
- return true;
+ if (!IsSID(entry->nBufferSize))
+ {
+ // the first voice frame
+ mCurrPlayingTS = entry->nTimestamp;
+ IMLOGD2("[Resync] currTs[%d], delay[%d]", mCurrPlayingTS, timeDiff);
+ return true;
+ }
+ else if (timeDiff > (mCurrJitterBufferSize - 1) * FRAME_INTERVAL)
+ {
+ mCurrPlayingTS = entry->nTimestamp;
+ IMLOGD2("[Resync] currTs[%d], delay[%d]", mCurrPlayingTS, timeDiff);
+ return true;
+ }
}
}