Merge "Audio player must not be used as a timesource before it's started."
This commit is contained in:
committed by
Android (Google) Code Review
commit
135616025f
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user