browser(firefox): do not crash when browser window is minimized (#9951)

This commit is contained in:
Yury Semikhatsky 2021-11-01 17:11:21 -07:00 committed by GitHub
parent 49cda3d3df
commit ddda507ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions

View File

@ -1,2 +1,2 @@
1301
Changed: max@schmitt.mx Mon 1 Nov 2021 16:28:05 CET
1302
Changed: yurys@chromium.org Mon 01 Nov 2021 05:04:30 PM PDT

View File

@ -159,6 +159,9 @@ class nsScreencastService::Session : public rtc::VideoSinkInterface<webrtc::Vide
void OnRawFrame(uint8_t* videoFrame, size_t videoFrameStride, const webrtc::VideoCaptureCapability& frameInfo) override {
int pageWidth = frameInfo.width - mMargin.LeftRight();
int pageHeight = frameInfo.height - mMargin.TopBottom();
// Frame size is 1x1 when browser window is minimized.
if (pageWidth <= 1 || pageHeight <= 1)
return;
// Headed Firefox brings sizes in sync slowly.
if (mViewportWidth && pageWidth > mViewportWidth)
pageWidth = mViewportWidth;

View File

@ -1,2 +1,2 @@
1299
Changed: max@schmitt.mx Mon 1 Nov 2021 16:28:05 CET
1300
Changed: yurys@chromium.org Mon 01 Nov 2021 05:00:33 PM PDT

View File

@ -159,6 +159,9 @@ class nsScreencastService::Session : public rtc::VideoSinkInterface<webrtc::Vide
void OnRawFrame(uint8_t* videoFrame, size_t videoFrameStride, const webrtc::VideoCaptureCapability& frameInfo) override {
int pageWidth = frameInfo.width - mMargin.LeftRight();
int pageHeight = frameInfo.height - mMargin.TopBottom();
// Frame size is 1x1 when browser window is minimized.
if (pageWidth <= 1 || pageHeight <= 1)
return;
// Headed Firefox brings sizes in sync slowly.
if (mViewportWidth && pageWidth > mViewportWidth)
pageWidth = mViewportWidth;