Bug 1382303 - P3. Reduce enough data threadhold to 10s. r?jwwang draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 20 Jul 2017 20:49:06 +0200
changeset 613111 29f012f3667f0ff4ec0d5ab0589e31cbc260d767
parent 613110 96a9730dbdbec784c7cd5a6be2dc479355d3f7ba
child 613119 336ef5746a073ce097e09e59a811332da15917ce
push id69735
push userbmo:jyavenard@mozilla.com
push dateFri, 21 Jul 2017 16:41:57 +0000
reviewersjwwang
bugs1382303
milestone56.0a1
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
dom/media/mediasource/MediaSourceDecoder.cpp
--- 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());