Bug 1309516 part 8 - modify MDSM::RecomputeDuration();r?jwwang
MozReview-Commit-ID: 6pM7Kn3kZco
--- 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