diff options
author | Andreas Huber <andih@google.com> | 2010-09-28 13:13:38 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-09-28 13:13:38 -0700 |
commit | c7d368d990303dc5369c7c61579f88c5059dc8d7 (patch) | |
tree | b14a6f51fc145d8f63bfbda1124f4b1b944bbdd8 /media | |
parent | ed54ad0f8619ae416b0968ade6248894cbfc4dba (diff) | |
download | frameworks_av-c7d368d990303dc5369c7c61579f88c5059dc8d7.zip frameworks_av-c7d368d990303dc5369c7c61579f88c5059dc8d7.tar.gz frameworks_av-c7d368d990303dc5369c7c61579f88c5059dc8d7.tar.bz2 |
Properly flush the AudioTrack/AudioSink on a seek request and make sure that both the mp3 decoder and aac software decoders start fresh after a seek without any dependency on previously decoded content.
Change-Id: I4909fdf19518dbabb6c340e2a31b50dfe6c5b067
related-to-bug: 3029947
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/AudioPlayer.cpp | 6 | ||||
-rw-r--r-- | media/libstagefright/codecs/aacdec/AACDecoder.cpp | 4 | ||||
-rw-r--r-- | media/libstagefright/codecs/mp3dec/MP3Decoder.cpp | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp index 47a385d..b314114 100644 --- a/media/libstagefright/AudioPlayer.cpp +++ b/media/libstagefright/AudioPlayer.cpp @@ -423,6 +423,12 @@ status_t AudioPlayer::seekTo(int64_t time_us) { mReachedEOS = false; mSeekTimeUs = time_us; + if (mAudioSink != NULL) { + mAudioSink->flush(); + } else { + mAudioTrack->flush(); + } + return OK; } diff --git a/media/libstagefright/codecs/aacdec/AACDecoder.cpp b/media/libstagefright/codecs/aacdec/AACDecoder.cpp index e4ed5e6..f58c16d 100644 --- a/media/libstagefright/codecs/aacdec/AACDecoder.cpp +++ b/media/libstagefright/codecs/aacdec/AACDecoder.cpp @@ -171,6 +171,10 @@ status_t AACDecoder::read( mInputBuffer->release(); mInputBuffer = NULL; } + + // Make sure that the next buffer output does not still + // depend on fragments from the last one decoded. + PVMP4AudioDecoderResetBuffer(mDecoderBuf); } else { seekTimeUs = -1; } diff --git a/media/libstagefright/codecs/mp3dec/MP3Decoder.cpp b/media/libstagefright/codecs/mp3dec/MP3Decoder.cpp index c4a8280..59dd740 100644 --- a/media/libstagefright/codecs/mp3dec/MP3Decoder.cpp +++ b/media/libstagefright/codecs/mp3dec/MP3Decoder.cpp @@ -132,6 +132,10 @@ status_t MP3Decoder::read( mInputBuffer->release(); mInputBuffer = NULL; } + + // Make sure that the next buffer output does not still + // depend on fragments from the last one decoded. + pvmp3_InitDecoder(mConfig, mDecoderBuf); } else { seekTimeUs = -1; } |