Bug 1258562: MSE] Abort if MediaSource has been shutdown. r?gerald
The assumption was made that this code was never called if MediaSourceDecoder::NextFrameBufferedStatus() had been called before. However, that assumption was incorrect as NextFrameBufferedStatus() is only called if we had determine we had no frame buffered.
MozReview-Commit-ID: 1hsEJuInION
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -272,16 +272,21 @@ MediaSourceDecoder::NextFrameBufferedSta
? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
: MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
}
bool
MediaSourceDecoder::CanPlayThrough()
{
MOZ_ASSERT(NS_IsMainThread());
+
+ if (NextFrameBufferedStatus() == MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE) {
+ return false;
+ }
+
if (IsNaN(mMediaSource->Duration())) {
// Don't have any data yet.
return false;
}
TimeUnit duration = TimeUnit::FromSeconds(mMediaSource->Duration());
TimeUnit currentPosition = TimeUnit::FromMicroseconds(CurrentPosition());
if (duration.IsInfinite()) {
// We can't make an informed decision and just assume that it's a live stream