Bug 1185416 - Don't stop AudioSink prematurely when decoding is completed. r=kinetik.
authorJW Wang <jwwang@mozilla.com>
Sun, 19 Jul 2015 21:25:02 +0800
changeset 254058 934dcc90d4ac5c2c78f8e451e67e56d930e5e041
parent 254057 cfc312d8ef205bcb6a58b840459a4ccd922dcf88
child 254059 621c0ceeea21d63525ce92b9dbeb1ea38429408d
push id29087
push usercbook@mozilla.com
push dateWed, 22 Jul 2015 12:01:23 +0000
treeherdermozilla-central@e7434cafdf2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1185416
milestone42.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 1185416 - Don't stop AudioSink prematurely when decoding is completed. r=kinetik.
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2451,23 +2451,23 @@ nsresult MediaDecoderStateMachine::RunSt
         clockTime = std::max(int64_t(0), std::max(clockTime, Duration().ToMicroseconds()));
         UpdatePlaybackPosition(clockTime);
 
         nsCOMPtr<nsIRunnable> event =
           NS_NewRunnableMethod(mDecoder, &MediaDecoder::PlaybackEnded);
         AbstractThread::MainThread()->Dispatch(event.forget());
 
         mSentPlaybackEndedEvent = true;
+
+        // Stop audio sink after call to AudioEndTime() above, otherwise it will
+        // return an incorrect value due to a null mAudioSink.
+        StopAudioThread();
+        mDecodedStream->StopPlayback();
       }
 
-      // Stop audio sink after call to AudioEndTime() above, otherwise it will
-      // return an incorrect value due to a null mAudioSink.
-      StopAudioThread();
-      mDecodedStream->StopPlayback();
-
       return NS_OK;
     }
   }
 
   return NS_OK;
 }
 
 void