Bug 1482116 - Only schedule update when a track exists. r=bryce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 09 Aug 2018 16:24:33 +0000
changeset 485892 bb68137ed8a9714a637f90d197e7837fa8de80f4
parent 485891 1a03fc28195e1a29978a2cd25ca6e5900f2d59da
child 485893 65a6a118cb1a7bbe4c2af3ee41e89eb6704f48bc
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbryce
bugs1482116
milestone63.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 1482116 - Only schedule update when a track exists. r=bryce Add assertion to more easily catch the problem Differential Revision: https://phabricator.services.mozilla.com/D3018
dom/media/MediaFormatReader.cpp
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -1469,18 +1469,22 @@ MediaFormatReader::ResolveSetCDMPromiseI
   MOZ_ASSERT(mCDMProxy);
   if (mSetCDMForTracks.contains(aTrack)) {
     mSetCDMForTracks -= aTrack;
   }
 
   if (mSetCDMForTracks.isEmpty()) {
     LOGV("%s : Done ", __func__);
     mSetCDMPromise.Resolve(/* aIgnored = */ true, __func__);
-    ScheduleUpdate(TrackInfo::kAudioTrack);
-    ScheduleUpdate(TrackInfo::kVideoTrack);
+    if (HasAudio()) {
+      ScheduleUpdate(TrackInfo::kAudioTrack);
+    }
+    if (HasVideo()) {
+      ScheduleUpdate(TrackInfo::kVideoTrack);
+    }
     return true;
   }
   LOGV("%s : %s track is ready.", __func__, TrackTypeToStr(aTrack));
   return false;
 }
 
 void
 MediaFormatReader::PrepareToSetCDMForTrack(TrackType aTrack)
@@ -2216,16 +2220,19 @@ MediaFormatReader::NeedInput(DecoderData
 void
 MediaFormatReader::ScheduleUpdate(TrackType aTrack)
 {
   MOZ_ASSERT(OnTaskQueue());
   if (mShutdown) {
     return;
   }
   auto& decoder = GetDecoderData(aTrack);
+  MOZ_RELEASE_ASSERT(decoder.GetCurrentInfo(),
+                     "Can only schedule update when track exists");
+
   if (decoder.mUpdateScheduled) {
     return;
   }
   LOGV("SchedulingUpdate(%s)", TrackTypeToStr(aTrack));
   decoder.mUpdateScheduled = true;
   RefPtr<nsIRunnable> task(NewRunnableMethod<TrackType>(
     "MediaFormatReader::Update", this, &MediaFormatReader::Update, aTrack));
   nsresult rv = OwnerThread()->Dispatch(task.forget());