summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-03-16 10:41:25 -0700
committerAndreas Huber <andih@google.com>2011-03-16 12:04:56 -0700
commitae03031ab6af9505335e888b709ee661fe04ed83 (patch)
treed8f0cc2b24fe221eb201eb0c76b0c5dd942f05de
parent427f147cce909f1af7dc47ab2e5353d79bf6cd5f (diff)
DO NOT MERGE: Fix a race condition when playing an audio-only stream and seeking before starting.
Change-Id: I70dfdfb7c27e3c713079c359ef89a570eb600dc7 related-to-bug: 4039068
-rw-r--r--media/libstagefright/AwesomePlayer.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index 5734c7ea..1f8de9f2 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -750,8 +750,6 @@ status_t AwesomePlayer::play_l() {
mFlags |= PLAYING;
mFlags |= FIRST_FRAME;
- bool deferredAudioSeek = false;
-
if (mDecryptHandle != NULL) {
int64_t position;
getPosition(&position);
@@ -767,10 +765,11 @@ status_t AwesomePlayer::play_l() {
mTimeSource = mAudioPlayer;
- deferredAudioSeek = true;
-
- mWatchForAudioSeekComplete = false;
- mWatchForAudioEOS = true;
+ // If there was a seek request before we ever started,
+ // honor the request now.
+ // Make sure to do this before starting the audio player
+ // to avoid a race condition.
+ seekAudioIfNecessary_l();
}
}
@@ -808,12 +807,6 @@ status_t AwesomePlayer::play_l() {
}
}
- if (deferredAudioSeek) {
- // If there was a seek request while we were paused
- // and we're just starting up again, honor the request now.
- seekAudioIfNecessary_l();
- }
-
if (mFlags & AT_EOS) {
// Legacy behaviour, if a stream finishes playing and then
// is started again, we play from the start...