Bug 1374475 - Don't throttle download of media files under 8MB in size. r=jwwang

The startup latency for an HTTP transaction can be high, this adds delay when
we're seeking into an unbuffered range. So we should not throttle the download
for small files, to speed up seeking.

This also works around the problem in bug 1373618 in the case where the
download is fast enough for the entire file to predownload before a seek.

MozReview-Commit-ID: A8Hqi71IJ1H

--HG--
extra : rebase_source : 30648d3ad62b8c0417b1244c896b43b670382e9c
This commit is contained in:
Chris Pearce 2017-06-20 13:03:49 +12:00
Родитель 674483db72
Коммит 3d1e87597e
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -1030,6 +1030,15 @@ MediaDecoder::ShouldThrottleDownload()
MOZ_ASSERT(NS_IsMainThread());
NS_ENSURE_TRUE(mDecoderStateMachine, false);
int64_t length = mResource->GetLength();
if (length > 0 &&
length <= int64_t(MediaPrefs::MediaMemoryCacheMaxSize()) * 1024) {
// Don't throttle the download of small resources. This is to speed
// up seeking, as seeks into unbuffered ranges would require starting
// up a new HTTP transaction, which adds latency.
return false;
}
if (Preferences::GetBool("media.throttle-regardless-of-download-rate",
false)) {
return true;