Bug 1389304 - Don't update duration to negative buffer end - r?jya
MozReview-Commit-ID: 5rbbJRk62tO
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -3134,22 +3134,22 @@ void MediaDecoderStateMachine::BufferedR
// since we haven't played the frame at the end of buffered data. So update
// mDuration here as new data is downloaded to prevent such a lag.
if (mBuffered.Ref().IsInvalid()) {
return;
}
bool exists;
media::TimeUnit end{ mBuffered.Ref().GetEnd(&exists) };
- if (!exists) {
+ if (!exists || !end.IsPositive()) {
return;
}
// Use estimated duration from buffer ranges when mDuration is unknown or
- // the estimated duration is larger.
+ // the estimated duration is larger (and positive).
if (mDuration.Ref().isNothing() || mDuration.Ref()->IsInfinite() ||
end > mDuration.Ref().ref()) {
mDuration = Some(end);
}
}
RefPtr<MediaDecoder::SeekPromise>
MediaDecoderStateMachine::Seek(const SeekTarget& aTarget)