Bug 1377206 - Explicitly disable throttling of media HTTP responses, r=cpearce

--HG--
extra : rebase_source : 01f913c44c7ce02bedd733faaf11262353f3461d
This commit is contained in:
Honza Bambas 2017-08-04 04:38:00 +02:00
Родитель 62072603a7
Коммит e372b0a90f
2 изменённых файлов: 20 добавлений и 7 удалений

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

@ -1196,14 +1196,19 @@ public:
return;
}
nsCOMPtr<nsIClassOfService> cos;
if (aElement->mUseUrgentStartForChannel &&
(cos = do_QueryInterface(channel))) {
cos->AddClassFlags(nsIClassOfService::UrgentStart);
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(channel));
if (cos) {
if (aElement->mUseUrgentStartForChannel) {
cos->AddClassFlags(nsIClassOfService::UrgentStart);
// Reset the flag to avoid loading again without initiated by user
// interaction.
aElement->mUseUrgentStartForChannel = false;
// Reset the flag to avoid loading again without initiated by user
// interaction.
aElement->mUseUrgentStartForChannel = false;
}
// Unconditionally disable throttling since we want the media to fluently
// play even when we switch the tab to background.
cos->AddClassFlags(nsIClassOfService::DontThrottle);
}
// The listener holds a strong reference to us. This creates a

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

@ -14,6 +14,7 @@
#include "nsDebug.h"
#include "nsNetUtil.h"
#include "nsThreadUtils.h"
#include "nsIClassOfService.h"
#include "nsIFile.h"
#include "nsIFileChannel.h"
#include "nsIFileStreams.h"
@ -847,6 +848,13 @@ ChannelMediaResource::RecreateChannel()
loadFlags);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIClassOfService> cos(do_QueryInterface(mChannel));
if (cos) {
// Unconditionally disable throttling since we want the media to fluently
// play even when we switch the tab to background.
cos->AddClassFlags(nsIClassOfService::DontThrottle);
}
mSuspendAgent.NotifyChannelOpened(mChannel);
// Tell the cache to reset the download status when the channel is reopened.