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

This commit is contained in:
Andreas Huber
2010-09-28 13:23:26 -07:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}