Bug 1294648 - [MSE] Return early if mediasource isn't attached. r=gerald, a=lizzard
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 12 Aug 2016 20:56:45 +1000
changeset 349780 ccba4736e261379bccb00e4310907cca142cdae7
parent 349779 0ed2f1ac56179d718bf9802dff06779d2687e3ef
child 349781 3fa9b262d4e54faa7694e6f9bc0827a2b470d64f
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald, lizzard
bugs1294648
milestone50.0a2
Bug 1294648 - [MSE] Return early if mediasource isn't attached. r=gerald, a=lizzard MozReview-Commit-ID: 9hCi5sPbZpW
dom/media/mediasource/MediaSourceDecoder.cpp
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -109,16 +109,20 @@ MediaSourceDecoder::GetSeekable()
   return seekable;
 }
 
 media::TimeIntervals
 MediaSourceDecoder::GetBuffered()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
+  if (!mMediaSource) {
+    NS_WARNING("MediaSource element isn't attached");
+    return media::TimeIntervals::Invalid();
+  }
   dom::SourceBufferList* sourceBuffers = mMediaSource->ActiveSourceBuffers();
   if (!sourceBuffers) {
     // Media source object is shutting down.
     return TimeIntervals();
   }
   media::TimeUnit highestEndTime;
   nsTArray<media::TimeIntervals> activeRanges;
   media::TimeIntervals buffered;