Bug 1309516 part 8 - modify MDSM::RecomputeDuration();r?jwwang draft
authorKaku Kuo <kaku@mozilla.com>
Mon, 24 Oct 2016 15:04:52 +0800
changeset 441574 25d91eb128bc173839d3022987b192b39cb21323
parent 441573 ad72bba42fdf1506f6abcdc0d1b3bfb48b1c2b37
child 441575 9e71897e8cc51bb802a01ef6bd3709b9539be441
push id36449
push userbmo:kaku@mozilla.com
push dateSat, 19 Nov 2016 07:05:35 +0000
reviewersjwwang
bugs1309516
milestone53.0a1
Bug 1309516 part 8 - modify MDSM::RecomputeDuration();r?jwwang MozReview-Commit-ID: 6pM7Kn3kZco
dom/media/MediaDecoderStateMachine.cpp
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2294,17 +2294,20 @@ void MediaDecoderStateMachine::Recompute
       // any other duration sources), but the duration isn't ready yet.
       return;
     }
     // We don't fire duration changed for this case because it should have
     // already been fired on the main thread when the explicit duration was set.
     duration = TimeUnit::FromSeconds(d);
   } else if (mEstimatedDuration.Ref().isSome()) {
     duration = mEstimatedDuration.Ref().ref();
-  } else if (Info().mMetadataDuration.isSome()) {
+  } else if (mInfo.isSome() && Info().mMetadataDuration.isSome()) {
+    // We need to check mInfo.isSome() because that this method might be invoked
+    // while mObservedDuration is changed which might before the metadata been
+    // read.
     duration = Info().mMetadataDuration.ref();
   } else {
     return;
   }
 
   // Only adjust the duration when an explicit duration isn't set (MSE).
   // The duration is always exactly known with MSE and there's no need to adjust
   // it based on what may have been seen in the past; in particular as this data