summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AudioPlayer.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-03-08 15:46:13 -0800
committerAndreas Huber <andih@google.com>2010-03-08 15:46:13 -0800
commite7e3b785a0e7819db4c895a4f60e9a4dd755880c (patch)
treeb7ddcb8035885f9d8a51442fc94a632bbdc7fe27 /media/libstagefright/AudioPlayer.cpp
parent1322e7ebc33e8e161fb73cd47e43dd93357608e4 (diff)
downloadframeworks_av-e7e3b785a0e7819db4c895a4f60e9a4dd755880c.zip
frameworks_av-e7e3b785a0e7819db4c895a4f60e9a4dd755880c.tar.gz
frameworks_av-e7e3b785a0e7819db4c895a4f60e9a4dd755880c.tar.bz2
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
Diffstat (limited to 'media/libstagefright/AudioPlayer.cpp')
-rw-r--r--media/libstagefright/AudioPlayer.cpp11
1 files changed, 7 insertions, 4 deletions
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<MediaSource> &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<MetaData> format = mSource->getFormat();