Skip to content

Commit

Permalink
fix(supermediaplayer): fix wrong deltaTimeTmp increase logic
Browse files Browse the repository at this point in the history
Signed-off-by: pingkai <pingkai010@gmail.com>
  • Loading branch information
pingkai committed Sep 11, 2020
1 parent e8d7733 commit 5f8cfb6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mediaPlayer/SuperMediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1986,12 +1986,17 @@ RENDER_RESULT SuperMediaPlayer::RenderAudio()
if (mLastAudioFrameDuration > 0) {
int64_t offset = pts - (mPlayedAudioPts + mLastAudioFrameDuration);

if (llabs(offset) > 200000) {
/*
* the mLastAudioFrameDuration and the pts are all not the accurate value,
* the mLastAudioFrameDuration accurate for 1/1000000 s,
* the pts maybe accurate for 1/1000 s (eg. flv file), so can't increase the deltaTimeTmp when
* offset little than 1ms.
*/
if (llabs(offset) > 1000) {
AF_LOGW("offset is %lld,pts is %lld", offset, pts);
mAudioTime.deltaTimeTmp += offset;
}

mAudioTime.deltaTimeTmp += offset;

if (llabs(mAudioTime.deltaTimeTmp) > 100000) {
AF_LOGW("correct audio and master clock offset is %lld, frameDuration :%lld", mAudioTime.deltaTimeTmp,
mLastAudioFrameDuration);
Expand Down

0 comments on commit 5f8cfb6

Please sign in to comment.