diff options
author | Bodam Nam <bodamnam@google.com> | 2023-03-24 10:19:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-03-24 10:19:27 +0000 |
commit | 06d0a0e72190f6840a138d41aa7399cffb345f7f (patch) | |
tree | bd02407e12ff20cc119ab886ba092dd646991c49 /service | |
parent | 80fb0bc91a885a2de2497fe4d0d4ec491f5cb73c (diff) | |
parent | 498fad32cf67fdb3a772d0f0108c775a1a1cf33a (diff) | |
download | ImsMedia-06d0a0e72190f6840a138d41aa7399cffb345f7f.tar.gz |
Merge "Fix the SID playout delay issue" into udc-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/src/com/android/telephony/imsmedia/lib/libimsmedia/core/audio/AudioJitterBuffer.cpp | 32 |
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; + } } } |