Commit 2d9ba155 authored by Michael Crouse's avatar Michael Crouse Committed by Commit Bot

[LiteVideo] Update Media Rebuffer StopThrottle only when allowed.

The LiteVideoObserver observes media rebuffering events and sends
a stop throttling message to the hints agent. This should only
happen if LiteVideos were allowed and a hint sent in the first
place. This also removes the dcheck in the hints agent as
the design changed so the DCHECK is not needed.

Bug: 1125922
Change-Id: I3b65a78acc54bd267ecbabd03e8fd23bea99aad7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2398958Reviewed-by: default avatarSophie Chang <sophiechang@chromium.org>
Reviewed-by: default avatarrajendrant <rajendrant@chromium.org>
Commit-Queue: rajendrant <rajendrant@chromium.org>
Auto-Submit: Michael Crouse <mcrouse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804953}
parent 0555c7e2
......@@ -245,11 +245,6 @@ void LiteVideoObserver::MediaBufferUnderflow(const content::MediaPlayerId& id) {
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
loading_hints_agent;
if (render_frame_host->GetRemoteAssociatedInterfaces()) {
render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(
&loading_hints_agent);
loading_hints_agent->StopThrottlingMediaRequests();
}
// Only consider a rebuffer event related to LiteVideos if they
// were allowed on current navigation.
if (!nav_metrics_ ||
......@@ -257,6 +252,12 @@ void LiteVideoObserver::MediaBufferUnderflow(const content::MediaPlayerId& id) {
return;
}
if (render_frame_host->GetRemoteAssociatedInterfaces()) {
render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(
&loading_hints_agent);
loading_hints_agent->StopThrottlingMediaRequests();
}
nav_metrics_->SetThrottleResult(
lite_video::LiteVideoThrottleResult::kThrottleStoppedOnRebuffer);
......
......@@ -87,12 +87,8 @@ void LiteVideoHintAgent::SetLiteVideoHint(
}
void LiteVideoHintAgent::StopThrottling() {
// TODO(rajendrant): Send the stop throttling signal to browser process, after
// some K rebuffer events had occurred.
DCHECK(HasLiteVideoHint());
for (auto* throttle : active_throttles_) {
for (auto* throttle : active_throttles_)
throttle->ResumeIfThrottled();
}
kilobytes_buffered_before_throttle_ = 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment