Bug 1184221 - Fix null dereferences at mozilla::TrackBuffer::UpdateBufferedRanges(). r=jyavenard , a=ritu
authorSteven Michaud <smichaud@pobox.com>
Fri, 17 Jul 2015 18:10:07 -0500
changeset 281606 5fc78d653b9b1750dc3358cc34d90e2b3d465a9d
parent 281605 3c77c1a7ae0b7b34c64b0a0db76fee5433f12ae5
child 281607 c4f8219f3ea30a80e5adcd3ec4b4c759ee708f34
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjyavenard, ritu
bugs1184221
milestone41.0a2
Bug 1184221 - Fix null dereferences at mozilla::TrackBuffer::UpdateBufferedRanges(). r=jyavenard , a=ritu
dom/media/mediasource/TrackBuffer.cpp
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -293,17 +293,21 @@ TrackBuffer::AppendDataToCurrentResource
   mCurrentDecoder->SetRealMediaDuration(mCurrentDecoder->GetRealMediaDuration() + aDuration);
 
   return appendOffset;
 }
 
 nsRefPtr<TrackBuffer::BufferedRangesUpdatedPromise>
 TrackBuffer::UpdateBufferedRanges(Interval<int64_t> aByteRange, bool aNotifyParent)
 {
-  if (aByteRange.Length()) {
+  if (!mParentDecoder) {
+    return BufferedRangesUpdatedPromise::CreateAndResolve(true, __func__);
+  }
+
+  if (mCurrentDecoder && aByteRange.Length()) {
     mCurrentDecoder->GetReader()->NotifyDataArrived(aByteRange);
   }
 
   // Recalculate and cache our new buffered range.
   {
     ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
     TimeIntervals buffered;