diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER index 5b3ada0456..70cd825f99 100644 --- a/browser_patches/firefox/BUILD_NUMBER +++ b/browser_patches/firefox/BUILD_NUMBER @@ -1,2 +1,2 @@ -1168 -Changed: joel.einbinder@gmail.com Thu 27 Aug 2020 03:42:20 AM PDT +1169 +Changed: yurys@chromium.org Tue Sep 1 17:07:52 PDT 2020 diff --git a/browser_patches/firefox/juggler/screencast/ScreencastEncoder.cpp b/browser_patches/firefox/juggler/screencast/ScreencastEncoder.cpp index 9989484824..e281857211 100644 --- a/browser_patches/firefox/juggler/screencast/ScreencastEncoder.cpp +++ b/browser_patches/firefox/juggler/screencast/ScreencastEncoder.cpp @@ -122,23 +122,24 @@ public: } auto src = m_frameBuffer->GetI420(); - - const int y_stride = image->stride[0]; - MOZ_ASSERT(image->stride[1] == image->stride[2]); + const int y_stride = image->stride[VPX_PLANE_Y]; + MOZ_ASSERT(image->stride[VPX_PLANE_U] == image->stride[VPX_PLANE_V]); const int uv_stride = image->stride[1]; - uint8_t* y_data = image->planes[0]; - uint8_t* u_data = image->planes[1]; - uint8_t* v_data = image->planes[2]; + uint8_t* y_data = image->planes[VPX_PLANE_Y]; + uint8_t* u_data = image->planes[VPX_PLANE_U]; + uint8_t* v_data = image->planes[VPX_PLANE_V]; - if (m_scale) { - int src_width = src->width() - m_margin.LeftRight(); - double dst_width = src_width * m_scale.value(); + double src_width = src->width() - m_margin.LeftRight(); + double src_height = src->height() - m_margin.top; + + if (m_scale || (src_width > image->w || src_height > image->h)) { + double scale = m_scale ? m_scale.value() : std::min(image->w / src_width, image->h / src_height); + double dst_width = src_width * scale; if (dst_width > image->w) { src_width *= image->w / dst_width; dst_width = image->w; } - int src_height = src->height() - m_margin.TopBottom(); - double dst_height = src_height * m_scale.value(); + double dst_height = src_height * scale; if (dst_height > image->h) { src_height *= image->h / dst_height; dst_height = image->h; @@ -153,8 +154,8 @@ public: dst_width, dst_height, libyuv::kFilterBilinear); } else { - int width = std::min(image->w, src->width() - m_margin.LeftRight()); - int height = std::min(image->h, src->height() - m_margin.TopBottom()); + int width = std::min(image->w, src_width); + int height = std::min(image->h, src_height); libyuv::I420Copy(src->DataY() + m_margin.top * src->StrideY() + m_margin.left, src->StrideY(), src->DataU() + (m_margin.top * src->StrideU() + m_margin.left) / 2, src->StrideU(), diff --git a/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp b/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp index 595a7cef5e..e4b6fadf86 100644 --- a/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp +++ b/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp @@ -148,10 +148,16 @@ nsresult nsScreencastService::StartVideoRecording(nsIDocShell* aDocShell, const if (scale) maybeScale = Some(scale); + gfx::IntMargin margin; + // On GTK the bottom of the client rect is below the bounds and + // client size is actually equal to the size of the bounds so + // we don't need an adjustment. +#ifndef MOZ_WIDGET_GTK auto bounds = widget->GetScreenBounds().ToUnknownRect(); auto clientBounds = widget->GetClientBounds().ToUnknownRect(); // Crop the image to exclude frame (if any). - gfx::IntMargin margin = bounds - clientBounds; + margin = bounds - clientBounds; +#endif // Crop the image to exclude controls. margin.top += offsetTop;