-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When stopped, a cloned MediaStreamTrack will stop its base MediaStrea…
…mTrack if the source is muted https://bugs.webkit.org/show_bug.cgi?id=260655 rdar://111534033 Reviewed by Eric Carlson. When we have two track clones, and the tracks are muted, stopping one of the track will end the other one. This is due to the fact that when stopping a track, we request the source to end. We then check each observer to know whether they are stopped, which is true when the track is muted. We are adding a ended flag in UserMediaCaptureManagerProxy::SourceProxy and we rename preventSourceFromStopping in preventSourceFromEnding to clarify what we are doing. * LayoutTests/fast/mediastream/stop-clone-when-muted-expected.txt: Added. * LayoutTests/fast/mediastream/stop-clone-when-muted.html: Added. * Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp: (WebCore::MediaStreamTrackPrivate::preventSourceFromEnding): (WebCore::MediaStreamTrackPrivate::preventSourceFromStopping): Deleted. * Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h: * Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp: (WebCore::RealtimeMediaSource::requestToEnd): * Source/WebCore/platform/mediastream/RealtimeMediaSource.h: * Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: (WebKit::UserMediaCaptureManagerProxy::SourceProxy::end): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::preventSourceFromEnding): (WebKit::UserMediaCaptureManagerProxy::SourceProxy::preventSourceFromStopping): Deleted. Canonical link: https://commits.webkit.org/267247@main
- Loading branch information
Showing
7 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
LayoutTests/fast/mediastream/stop-clone-when-muted-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
PASS Stopping a muted clone should not mute the track | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script> | ||
promise_test(async (test) => { | ||
const stream = await navigator.mediaDevices.getUserMedia({ video:true }); | ||
const track = stream.getVideoTracks()[0]; | ||
const trackClone = track.clone(); | ||
|
||
const promise = new Promise(resolve => track.onmute = resolve); | ||
if (window.internals) { | ||
internals.setMediaStreamTrackMuted(track, true); | ||
await promise; | ||
} | ||
|
||
const resultPromise = new Promise((resolve, reject) => { | ||
setTimeout(resolve, 500); | ||
track.onended = () => reject("track is ended"); | ||
}); | ||
trackClone.stop(); | ||
|
||
return resultPromise; | ||
}, "Stopping a muted clone should not mute the track"); | ||
</script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters