Bug 1382303 - P3. Reduce enough data threadhold to 10s. r?jwwang
We waited 30s until we changed readyState to HAVE_ENOUGH_DATA this would cause autoplay media element to start rather late. In particular with live stream. 10s is typically enough ahead time to start playback.
MozReview-Commit-ID: LJvY8cQYfwZ
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -303,22 +303,22 @@ MediaSourceDecoder::CanPlayThrough()
auto currentPosition = CurrentPosition();
if (duration.IsInfinite()) {
// We can't make an informed decision and just assume that it's a live
// stream
return true;
} else if (duration <= currentPosition) {
return true;
}
- // If we have data up to the mediasource's duration or 30s ahead, we can
+ // If we have data up to the mediasource's duration or 10s ahead, we can
// assume that we can play without interruption.
TimeIntervals buffered = GetBuffered();
buffered.SetFuzz(MediaSourceDemuxer::EOS_FUZZ / 2);
TimeUnit timeAhead =
- std::min(duration, currentPosition + TimeUnit::FromSeconds(30));
+ std::min(duration, currentPosition + TimeUnit::FromSeconds(10));
TimeInterval interval(currentPosition, timeAhead);
return buffered.ContainsStrict(ClampIntervalToEnd(interval));
}
TimeInterval
MediaSourceDecoder::ClampIntervalToEnd(const TimeInterval& aInterval)
{
MOZ_ASSERT(NS_IsMainThread());