-
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.
RTCRtpSender maxFramerate encoding parameter has no effect
https://bugs.webkit.org/show_bug.cgi?id=259271 rdar://problem/112397603 Reviewed by Eric Carlson. React to AddOrUpdateSink max_frame_rate_bps signal to enforce maxFramerate by decimating at the source level. Update RemoteRealtimeVideoSource::remoteVideoFrameAvailable to compute the observed frame rate so that decimation can happen in WebProcess. Update RealtimeOutgoingVideoSource to call addVideoFrameObserve with specified frame rate. * LayoutTests/webrtc/video-maxFramerate-expected.txt: Added. * LayoutTests/webrtc/video-maxFramerate.html: Added. * Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::startObservingVideoFrames): (WebCore::RealtimeOutgoingVideoSource::updateBlackFramesSending): (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): * Source/WebCore/platform/mediastream/RealtimeOutgoingVideoSource.h: * Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.cpp: (WebKit::RemoteRealtimeVideoSource::remoteVideoFrameAvailable): * Source/WebKit/WebProcess/cocoa/RemoteRealtimeVideoSource.h: Canonical link: https://commits.webkit.org/266128@main
- Loading branch information
Showing
7 changed files
with
112 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
|
||
PASS Testing that maxFramerate has an effect | ||
|
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,57 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Testing macFramerate</title> | ||
<script src="../resources/testharness.js"></script> | ||
<script src="../resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<video id="video" autoplay=""></video> | ||
<canvas id="canvas" width="640" height="480"></canvas> | ||
<script src ="routines.js"></script> | ||
<script> | ||
var pc1, pc2; | ||
promise_test(async (test) => { | ||
const localStream = await navigator.mediaDevices.getUserMedia({video:true}); | ||
const stream = await new Promise((resolve, reject) => { | ||
createConnections((firstConnection) => { | ||
pc1 = firstConnection; | ||
const sender = firstConnection.addTrack(localStream.getVideoTracks()[0], localStream); | ||
}, (secondConnection) => { | ||
pc2 = secondConnection; | ||
secondConnection.ontrack = (trackEvent) => { | ||
resolve(trackEvent.streams[0]); | ||
}; | ||
}); | ||
setTimeout(() => reject("Test timed out"), 5000); | ||
}); | ||
|
||
video.srcObject = stream; | ||
await video.play(); | ||
|
||
let settings = stream.getVideoTracks()[0].getSettings(); | ||
assert_equals(settings.width, 640, "remote track settings width"); | ||
assert_equals(settings.height, 480, "remote track settings height"); | ||
|
||
let counter = 0; | ||
while (++counter < 100 && settings.frameRate < 5) { | ||
await new Promise(resolve => setTimeout(resolve, 50)); | ||
settings = stream.getVideoTracks()[0].getSettings(); | ||
} | ||
assert_greater_than(settings.frameRate, 5, "remote track settings frame rate"); | ||
|
||
const parameters = pc1.getSenders()[0].getParameters(); | ||
parameters.encodings[0].maxFramerate = 1; | ||
await pc1.getSenders()[0].setParameters(parameters); | ||
|
||
counter = 0; | ||
while (++counter < 100 && settings.frameRate > 4) { | ||
await new Promise(resolve => setTimeout(resolve, 50)); | ||
settings = stream.getVideoTracks()[0].getSettings(); | ||
} | ||
assert_less_than(settings.frameRate, 4, "remote track settings reduced frame rate"); | ||
}, "Testing that maxFramerate has an effect"); | ||
</script> | ||
</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