Bug 1069289 - take |mAudioEndTime| into account when updating playback position at the end of playback. r=kinetik
authorJW Wang <jwwang@mozilla.com>
Tue, 07 Oct 2014 19:45:00 +0200
changeset 232498 60c38a8155cedfdd4b74fb38c478d9b9f8d05eee
parent 232497 fe0ccde065c68fda5f2a68c69775f635993793bd
child 232499 3a0d57d665bb7bab3ecd89ca32b0b2e8be79ad02
child 232547 62babb0d3ae28b5b4c8f9b4269d3aad6c8004d09
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1069289
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1069289 - take |mAudioEndTime| into account when updating playback position at the end of playback. r=kinetik
content/media/MediaDecoderStateMachine.cpp
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -2473,18 +2473,18 @@ nsresult MediaDecoderStateMachine::RunSt
         return NS_OK;
       }
 
       StopAudioThread();
       // When we're decoding to a stream, the stream's main-thread finish signal
       // will take care of calling MediaDecoder::PlaybackEnded.
       if (mDecoder->GetState() == MediaDecoder::PLAY_STATE_PLAYING &&
           !mDecoder->GetDecodedStream()) {
-        int64_t videoTime = HasVideo() ? mVideoFrameEndTime : 0;
-        int64_t clockTime = std::max(mEndTime, videoTime);
+        int64_t clockTime = std::max(mAudioEndTime, mVideoFrameEndTime);
+        clockTime = std::max(int64_t(0), std::max(clockTime, mEndTime));
         UpdatePlaybackPosition(clockTime);
 
         {
           // Wait for the state change is completed in the main thread,
           // otherwise we might see |mDecoder->GetState() == MediaDecoder::PLAY_STATE_PLAYING|
           // in next loop and send |MediaDecoder::PlaybackEnded| again to trigger 'ended'
           // event twice in the media element.
           ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());