| Index: content/browser/renderer_host/delegated_frame_host.cc
|
| diff --git a/content/browser/renderer_host/delegated_frame_host.cc b/content/browser/renderer_host/delegated_frame_host.cc
|
| index 6fa63cc3e0e09060f4d366b71ea16a0b84d819e4..9300541472fa59096c2d04342fc173e90e617819 100644
|
| --- a/content/browser/renderer_host/delegated_frame_host.cc
|
| +++ b/content/browser/renderer_host/delegated_frame_host.cc
|
| @@ -166,7 +166,8 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceToVideoFrame(
|
| &DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo,
|
| AsWeakPtr(), // For caching the ReadbackYUVInterface on this class.
|
| nullptr, target, callback));
|
| - request->set_area(src_subrect);
|
| + if (!src_subrect.IsEmpty())
|
| + request->set_area(src_subrect);
|
| RequestCopyOfOutput(std::move(request));
|
| }
|
|
|
| @@ -299,7 +300,6 @@ void DelegatedFrameHost::UpdateGutters() {
|
| bottom_gutter_->SetBounds(
|
| gfx::Rect(0, current_frame_size_in_dip_.height(), width, height));
|
| client_->DelegatedFrameHostGetLayer()->Add(bottom_gutter_.get());
|
| -
|
| } else {
|
| bottom_gutter_.reset();
|
| }
|
| @@ -371,18 +371,7 @@ void DelegatedFrameHost::AttemptFrameSubscriberCapture(
|
| subscriber_texture->target()));
|
| }
|
|
|
| - if (local_surface_id_.is_valid()) {
|
| - // To avoid unnecessary composites, go directly to the Surface rather than
|
| - // through RequestCopyOfOutput (which goes through the browser
|
| - // compositor).
|
| - if (!request_copy_of_output_callback_for_testing_.is_null())
|
| - request_copy_of_output_callback_for_testing_.Run(std::move(request));
|
| - else
|
| - surface_factory_->RequestCopyOfSurface(std::move(request));
|
| - } else {
|
| - request->set_area(gfx::Rect(current_frame_size_in_dip_));
|
| - RequestCopyOfOutput(std::move(request));
|
| - }
|
| + RequestCopyOfOutput(std::move(request));
|
| }
|
|
|
| void DelegatedFrameHost::SwapDelegatedFrame(uint32_t compositor_frame_sink_id,
|
| @@ -721,6 +710,10 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo(
|
| ? display_compositor::GLHelper::SCALER_QUALITY_BEST
|
| : display_compositor::GLHelper::SCALER_QUALITY_FAST;
|
|
|
| + DVLOG(1) << "Re-creating YUV readback pipeline for source rect "
|
| + << result_rect.ToString() << " and destination size "
|
| + << region_in_frame.size().ToString();
|
| +
|
| dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV(
|
| quality, result_rect.size(), result_rect, region_in_frame.size(), true,
|
| true));
|
| @@ -863,6 +856,24 @@ void DelegatedFrameHost::RequestCopyOfOutput(
|
| std::unique_ptr<cc::CopyOutputRequest> request) {
|
| if (!request_copy_of_output_callback_for_testing_.is_null()) {
|
| request_copy_of_output_callback_for_testing_.Run(std::move(request));
|
| + return;
|
| + }
|
| +
|
| + // If a specific area has not been requested, set one to ensure correct
|
| + // clipping occurs.
|
| + if (!request->has_area())
|
| + request->set_area(gfx::Rect(current_frame_size_in_dip_));
|
| +
|
| + // To avoid unnecessary browser composites, try to go directly to the Surface
|
| + // rather than through the Layer.
|
| + if (local_surface_id_.is_valid()) {
|
| + // Surfaces interpret the request area in terms of their own coordinate
|
| + // system, so adjust by the scale factor, if necessary.
|
| + if (current_scale_factor_ != 1.0) {
|
| + request->set_area(gfx::ScaleToEnclosingRect(
|
| + request->area(), current_scale_factor_, current_scale_factor_));
|
| + }
|
| + surface_factory_->RequestCopyOfSurface(std::move(request));
|
| } else {
|
| client_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput(
|
| std::move(request));
|
|
|