Bug 1069289 - Take |mAudioEndTime| into account when updating playback position at the end of playback. r=kinetik, a=lmandel
authorJW Wang <jwwang@mozilla.com>
Tue, 07 Oct 2014 19:45:00 +0200
changeset 225711 31fc68be9136
parent 225710 29dd7b8ee41f
child 225712 2535e75ff9c6
push id3988
push userryanvm@gmail.com
push date2014-10-17 01:37 +0000
treeherdermozilla-beta@c3fa7201e034 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik, lmandel
bugs1069289
milestone34.0
Bug 1069289 - Take |mAudioEndTime| into account when updating playback position at the end of playback. r=kinetik, a=lmandel
content/media/MediaDecoderStateMachine.cpp
--- a/content/media/MediaDecoderStateMachine.cpp
+++ b/content/media/MediaDecoderStateMachine.cpp
@@ -2456,18 +2456,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());