diff options
author | Andreas Huber <andih@google.com> | 2011-09-08 11:39:17 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-08 11:39:17 -0700 |
commit | 135616025f06dfdfff3d6bed51885ef8de5f49b5 (patch) | |
tree | a4cce888cbcafb76c194c64ed7ef842bf438d05f | |
parent | ab90899264407669725a24eb941de9278e82c70f (diff) | |
parent | 84584471624775a849c880a50efc351e47c4a4af (diff) | |
download | frameworks_base-135616025f06dfdfff3d6bed51885ef8de5f49b5.zip frameworks_base-135616025f06dfdfff3d6bed51885ef8de5f49b5.tar.gz frameworks_base-135616025f06dfdfff3d6bed51885ef8de5f49b5.tar.bz2 |
Merge "Audio player must not be used as a timesource before it's started."
-rw-r--r-- | media/libstagefright/AudioPlayer.cpp | 6 | ||||
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp index d41ab1b..ba076f5 100644 --- a/media/libstagefright/AudioPlayer.cpp +++ b/media/libstagefright/AudioPlayer.cpp @@ -20,8 +20,8 @@ #include <binder/IPCThreadState.h> #include <media/AudioTrack.h> +#include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/AudioPlayer.h> -#include <media/stagefright/MediaDebug.h> #include <media/stagefright/MediaDefs.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/MediaSource.h> @@ -60,7 +60,7 @@ AudioPlayer::~AudioPlayer() { } void AudioPlayer::setSource(const sp<MediaSource> &source) { - CHECK_EQ(mSource, NULL); + CHECK(mSource == NULL); mSource = source; } @@ -466,6 +466,8 @@ int64_t AudioPlayer::getRealTimeUs() { } int64_t AudioPlayer::getRealTimeUsLocked() const { + CHECK(mStarted); + CHECK_NE(mSampleRate, 0); return -mLatencyUs + (mNumFramesPlayed * 1000000) / mSampleRate; } diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 47224cc..07a46bd 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -1736,7 +1736,9 @@ void AwesomePlayer::onVideoEvent() { modifyFlags(TEXT_RUNNING, SET); } - TimeSource *ts = (mFlags & AUDIO_AT_EOS) ? &mSystemTimeSource : mTimeSource; + TimeSource *ts = + ((mFlags & AUDIO_AT_EOS) || !(mFlags & AUDIOPLAYER_STARTED)) + ? &mSystemTimeSource : mTimeSource; if (mFlags & FIRST_FRAME) { modifyFlags(FIRST_FRAME, CLEAR); |