From 577d6ccb7bff1e102bb4c9fe987ea13745cf5de0 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Mon, 9 Jan 2012 13:47:48 -0800 Subject: [PATCH] stagefright: limit audio gap for looped playback The audio gap when looping audio is mostly due to a delay requested by the audio player when executing the end of stream message. This is to allow the audio to be drained out of the pipe before actually stopping the AudioTrack. This delay is not needed when looping as the AudioTrack is not stopped. The fix consists in ignoring the requested delay when the looping flag is set in awesome player. Issue 5800981. Change-Id: Ib32d2930c53ecebc21ca8440e6e054c7e20db4a5 --- media/libstagefright/AwesomePlayer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 50c264e78ecc1..bc45f83d3d967 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1841,6 +1841,10 @@ void AwesomePlayer::postCheckAudioStatusEvent(int64_t delayUs) { return; } mAudioStatusEventPending = true; + // Do not honor delay when looping in order to limit audio gap + if (mFlags & (LOOPING | AUTO_LOOPING)) { + delayUs = 0; + } mQueue.postEventWithDelay(mCheckAudioStatusEvent, delayUs); }