Closed Bug 1807215 Opened 2 years ago Closed 1 year ago

Webcam window gets cropped after disabling/enabling it on Facebook calls

Categories

(Core :: WebRTC: Audio/Video, defect, P2)

defect

Tracking

()

VERIFIED FIXED
113 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox108 --- wontfix
firefox109 --- wontfix
firefox110 --- wontfix
firefox111 --- wontfix
firefox112 --- wontfix
firefox113 --- verified
firefox114 --- verified

People

(Reporter: oardelean, Assigned: pehrsons)

References

(Blocks 1 open bug, Regression, )

Details

(Keywords: regression)

Attachments

(12 files)

3.07 MB, image/png
Details
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
Attached image after re-enabling

Notes

  • This does not reproduce in Chrome. Please see the attached image for more details.

Found in

  • Firefox 110.0a1;

Affected versions

  • Firefox 110.0a1;
  • Firefox 109.0b6;
  • Firefox 108.0.1;

Tested platforms

  • Ubuntu 22;
  • macOS 12;

Affected platforms

  • Ubuntu 22;
  • macOS 12;

Preconditions

  • Have at least 2 people in the same Facebook video call.
  • Webcam is enabled.

Steps to reproduce

  1. Disable the webcam from the facebook camera button at the bottom of the call window.
  2. Enable the webcam.

Expected result

  • Webcam window resumes the same position before disabling it.

Actual result

  • Webcam window gets cropped to the right.

Regression range

  • Will look for one ASAP.
Severity: -- → S3
Has STR: --- → yes
QA Whiteboard: [qa-regression-triage]

Set release status flags based on info from the regressing bug 1757637

:padenot, since you are the author of the regressor, bug 1757637, could you take a look?

For more information, please visit auto_nag documentation.

Flags: needinfo?(padenot)
Keywords: regression

Fwiw this is where a video MediaStreamTrack triggers HTMLMediaElement::Invalidate which in turn triggers "resize" which is what Facebook should be reacting on.

Since the regressor made changes to videoWidth and videoHeight I assume this is related to the timing of "resize". That said I'm not sure why there would be resizes happening from disabling/enabling the camera. Perhaps they do something heavier than just set enabled on the track.

Maybe we're updating those values too late for the "resize" event? I think what we need is an HTMLMediaElement log of this happening.

Flags: needinfo?(padenot)

Set release status flags based on info from the regressing bug 1757637

This is what videoWidth and videoHeight depends on:

gfx::IntSize HTMLVideoElement::GetVideoIntrinsicDimensions() {
  layers::ImageContainer* container = GetImageContainer();
  // Prefer the size of the container as it's more up to date.
  if (container && container->GetCurrentSize().width != 0) {
    // But adjust to the aspect ratio of the container.
    float dar = static_cast<float>(mMediaInfo.mVideo.mDisplay.width) /
                mMediaInfo.mVideo.mDisplay.height;
    gfx::IntSize size = container->GetCurrentSize();
    float imageDar = static_cast<float>(size.width) / size.height;
    return gfx::IntSize(int(size.width * (dar / imageDar)), size.height);
  }
  return mMediaInfo.mVideo.mDisplay;
}

There's a new dependency on container->GetCurrentSize() that came with bug 1757637. Prior to that bug they only depended on mMediaInfo.mVideo.mDisplay.

The timing dependency between "resize" and mMediaInfo.mVideo.mDisplay is simple -- "resize" will fire after setting mMediaInfo.mVideo.mDisplay.

The timing dependency between "resize" and container->GetCurrentSize() is not much worse, just a bit more indirection. ImageContainer::GetCurrentSize() uses mCurrentImages[0].mImage->GetSize(). Whereas the same sync path that dispatches "resize" reads VideoFrameContainer::mMainThreadState.mIntrinsicSizeChanged, which comes from mFrames[0].second.mFrame.GetIntrinsicSize() that is passed to SetCurrentFrames, but also does a thread-hop. This thread-hop is fine since it gets dispatched before the thread-hop that sets mMediaInfo.mVideo.mDisplay (and dispatches "resize") gets dispatched.

So race-wise "resize" vs videoWidth/videoHeight seems fine. Bug 1757637 should only have made it so we start returning the new resolution earlier, though because container->GetCurrentSize() and mMediaInfo.mVideo.mDisplay are not in sync (set on different threads), it could be that GetVideoIntrinsicDimensions above returns the wrong aspect ratio for a bit while waiting for that main-thread hop. Could be worth experimenting with this.

A recording: https://pernos.co/debug/ULKlitbh9QFmaD7h1zq8Ow/index.html

I went to a messenger group call room and turned the camera off and on a number of times. Non-opt so took a while.

See this view for when HTMLVideoElement::GetVideoIntrinsicDimensions returns 1x1 erroneously. mMediaInfo.mVideo.mDisplay is 1280x720 as expected.

The 1x1 comes from the black frame we render when a video track becomes disabled, here.

Flags: needinfo?(padenot)
Duplicate of this bug: 1798876
Duplicate of this bug: 1800193

I think we should ask VideoFrameContainer for the current intrinsic size instead of ImageContainer for the current size. This is after all in HTMLVideoElement::GetVideoIntrinsicDimensions().

Assignee: nobody → apehrson
Status: NEW → ASSIGNED
Flags: needinfo?(padenot)
Priority: -- → P2
Blocks: 1825307
Blocks: 1785619

VideoFrameContainer already knows a frame's intrinsic size. The same intrinsic
size that drives media element invalidation.

ImageContainer just handles images and they don't have a notion of intrinsic
dimensions.

Pushed by pehrsons@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/e1759d7ac00e
Modernize wpt MST-ME-disabled-video-is-black. r=padenot
https://hg.mozilla.org/integration/autoland/rev/5eb150c1f051
In wpt MST-ME-disabled-video-is-black clean up in a cleanup task. r=padenot
https://hg.mozilla.org/integration/autoland/rev/263344e2a052
In MST-ME-disabled-video-is-black correctly log the checked pixel. r=padenot
https://hg.mozilla.org/integration/autoland/rev/2de3f8723542
In MST-ME-disabled-video-is-black expect to fill only the video element's intrinsic width and height. r=padenot
https://hg.mozilla.org/integration/autoland/rev/0c584facdd4d
Re-enable MST-ME-disabled-video-is-black. r=padenot
https://hg.mozilla.org/integration/autoland/rev/472b2b30e698
Add wpt testcase. r=padenot
https://hg.mozilla.org/integration/autoland/rev/d0057fb4ede0
Annotate VideoFrameContainer::mMutex. r=padenot
https://hg.mozilla.org/integration/autoland/rev/a2585761fea8
Expose a VideoFrameContainer's current intrinsic size. r=padenot
https://hg.mozilla.org/integration/autoland/rev/d444d0fb641b
Make the intrinsic size arg in MediaDecoderOwner::Invalidate a const ref. r=padenot
https://hg.mozilla.org/integration/autoland/rev/e149f608434e
Simplify intrinsic size handling in VideoFrameContainer by removing the intrinsicSizeChanged flag. r=padenot
https://hg.mozilla.org/integration/autoland/rev/6544f77c4e25
Take video element intrinsic dimensions from VideoFrameContainer instead of ImageContainer. r=padenot
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/39329 for changes under testing/web-platform/tests

Since nightly and release are affected, beta will likely be affected too.
For more information, please visit auto_nag documentation.

Upstream PR merged by moz-wptsync-bot
Flags: qe-verify+

Reproducible on a 2023-04-01 Nightly build on macOS 12.
Verified as fixed on Firefox 113.0b2(build ID: 20230411180038) and Nightly 114.0a1(build ID: 20230412092401) on macOS 12, Windows 10, Ubuntu 22.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: