tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit dc0a5c3422c9b3b99248b118930dfa2c8fd4b022
parent e3e650f6512bba10535c76f22c43f85dda3d8005
Author: Andreas Pehrson <apehrson@mozilla.com>
Date:   Thu, 23 Oct 2025 14:11:18 +0000

Bug 1771789 - Use "real fake" camera in some mochitests as loopback device does not work with native cloning. r=jib

Native cloning, which behaves like an independent gUM request, ends up using a
shared camera backend instance that is already live and does not need
reconfiguration.

The v4l2loopback device we set up on linux only issues a single frame during a
session. And since with deep cloning the session is reused, the new clone never
sees a frame, causing test_gUM_mediaStreamTrackClone.html, and intermittently
test_gUM_mediaElementCapture_tracks.html, to time out.

The "real fake" camera behaves like a normal camera in that it issues new frames
as requested, while still using the native capture stack.

Differential Revision: https://phabricator.services.mozilla.com/D266396

Diffstat:
Mdom/media/webrtc/tests/mochitests/test_getUserMedia_mediaElementCapture_tracks.html | 4++++
Mdom/media/webrtc/tests/mochitests/test_getUserMedia_mediaStreamTrackClone.html | 4++++
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dom/media/webrtc/tests/mochitests/test_getUserMedia_mediaElementCapture_tracks.html b/dom/media/webrtc/tests/mochitests/test_getUserMedia_mediaElementCapture_tracks.html @@ -22,6 +22,10 @@ let streamUntilEnded; const tracks = []; runTest(async () => { try { + await pushPrefs( + ["media.getusermedia.camera.fake.force", true], + ["media.video_loopback_dev", ""], + ); let stream = await getUserMedia({audio: true, video: true}); // We need to test with multiple tracks. We add an extra of each kind. for (const track of stream.getTracks()) { diff --git a/dom/media/webrtc/tests/mochitests/test_getUserMedia_mediaStreamTrackClone.html b/dom/media/webrtc/tests/mochitests/test_getUserMedia_mediaStreamTrackClone.html @@ -35,6 +35,10 @@ }); runTest(() => Promise.resolve() + .then(() => pushPrefs( + ["media.getusermedia.camera.fake.force", true], + ["media.video_loopback_dev", ""], + )) .then(() => testSingleTrackClonePlayback({audio: true})) .then(() => testSingleTrackClonePlayback({video: true})) .then(() => getUserMedia({video: true})).then(stream => {