Bug 1258562: MSE] Abort if MediaSource has been shutdown. r=gerald a=ritu
authorJean-Yves Avenard <jyavenard@mozilla.com>
Tue, 22 Mar 2016 10:34:30 +1100
changeset 311877 3cf9547052455c40906d3a875ddef2570535d7bb
parent 311876 8abadeccb04b26e49161b80718514f8801d1c54b
child 311878 7a461fddc3a948dc68a41f1ad90c64a6c5e479fb
push id47
push userkwierso@gmail.com
push dateWed, 23 Mar 2016 23:59:58 +0000
treeherdermozilla-esr45@7a461fddc3a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, ritu
bugs1258562
milestone45.0
Bug 1258562: MSE] Abort if MediaSource has been shutdown. r=gerald a=ritu The assumption was made that this code was never called if MediaSourceDecoder::NextFrameBufferedStatus() had been called before. However, that assumption was incorrect as NextFrameBufferedStatus() is only called if we had determine we had no frame buffered. MozReview-Commit-ID: 1hsEJuInION
dom/media/mediasource/MediaSourceDecoder.cpp
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -271,16 +271,21 @@ MediaSourceDecoder::NextFrameBufferedSta
     ? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
     : MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
 }
 
 bool
 MediaSourceDecoder::CanPlayThrough()
 {
   MOZ_ASSERT(NS_IsMainThread());
+
+  if (NextFrameBufferedStatus() == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE) {
+    return false;
+  }
+
   if (IsNaN(mMediaSource->Duration())) {
     // Don't have any data yet.
     return false;
   }
   TimeUnit duration = TimeUnit::FromSeconds(mMediaSource->Duration());
   TimeUnit currentPosition = TimeUnit::FromMicroseconds(CurrentPosition());
   if (duration.IsInfinite()) {
     // We can't make an informed decision and just assume that it's a live stream