Bug 1290780. Part 6 - Assert IsShutdown() is false in SetMediaSourceDuration(). r?jya draft
authorJW Wang <jwwang@mozilla.com>
Thu, 28 Jul 2016 15:52:30 +0800
changeset 395366 0801d5f8ef7bc8a834946c108c2d36467824a148
parent 395365 fb65cdf719306e129e7c95b6b96af991c526c81b
child 395367 a20e7f37b7658f94cc983c4389a0172b4b5badfe
push id24759
push userjwwang@mozilla.com
push dateTue, 02 Aug 2016 03:40:59 +0000
reviewersjya
bugs1290780
milestone50.0a1
Bug 1290780. Part 6 - Assert IsShutdown() is false in SetMediaSourceDuration(). r?jya 1. It is called from SetInitialDuration() when mMediaSource is non-null which happens before Shutdown() which clears |mMediaSource|. 2. It is called from MediaSource::SetDuration() which happens before MediaSourceDecoder::Shutdown() for |mDecoder| is non-null. 3. It is called from MediaSource::DurationChange() where |mDecoder| is non-null. MozReview-Commit-ID: 56AmWRLkkiv
dom/media/mediasource/MediaSourceDecoder.cpp
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -220,16 +220,17 @@ MediaSourceDecoder::SetInitialDuration(i
   }
   SetMediaSourceDuration(duration);
 }
 
 void
 MediaSourceDecoder::SetMediaSourceDuration(double aDuration)
 {
   MOZ_ASSERT(NS_IsMainThread());
+  MOZ_ASSERT(!IsShutdown());
   if (aDuration >= 0) {
     int64_t checkedDuration;
     if (NS_FAILED(SecondsToUsecs(aDuration, checkedDuration))) {
       // INT64_MAX is used as infinity by the state machine.
       // We want a very bigger number, but not infinity.
       checkedDuration = INT64_MAX - 1;
     }
     SetExplicitDuration(aDuration);