diff options
| author | 2010-09-28 13:23:26 -0700 | |
|---|---|---|
| committer | 2010-09-28 13:23:26 -0700 | |
| commit | 88a995edcf3c371845cb32aed8bcddb7509bf875 (patch) | |
| tree | 643fd3e58f6fb6bc5cbdb24660b973ae741dca72 | |
| parent | 6d028dd2f102a6eafaa2edebeb55f55b4c32fc42 (diff) | |
| parent | ad3fcfe845163e6fd40e13faf179c6c595963256 (diff) | |
Merge "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." into gingerbread
| -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 47a385d71de7..b3141147a80e 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 e4ed5e69b263..f58c16ddbff9 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 c4a828025060..59dd740d73ae 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; } |