From e7e3b785a0e7819db4c895a4f60e9a4dd755880c Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Mon, 8 Mar 2010 15:46:13 -0800 Subject: The audio track was accidentally not participating in the prefetch since it wasn't started at the time prepare() was called. Also, properly report the cached duration even near the end when the source has no more data to fetch. Change-Id: I66a92fec24c9bfb25f1c186f1c877127bae2b4f9 related-to-bug: 2444425 --- media/libstagefright/AudioPlayer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'media/libstagefright/AudioPlayer.cpp') diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp index 5e6e0da..005c64a 100644 --- a/media/libstagefright/AudioPlayer.cpp +++ b/media/libstagefright/AudioPlayer.cpp @@ -55,14 +55,17 @@ void AudioPlayer::setSource(const sp &source) { mSource = source; } -status_t AudioPlayer::start() { +status_t AudioPlayer::start(bool sourceAlreadyStarted) { CHECK(!mStarted); CHECK(mSource != NULL); - status_t err = mSource->start(); + status_t err; + if (!sourceAlreadyStarted) { + err = mSource->start(); - if (err != OK) { - return err; + if (err != OK) { + return err; + } } sp format = mSource->getFormat(); -- cgit v1.1