-
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.
WebRTC remote video codec factories should check video format strings…
… in a case insensitive way https://bugs.webkit.org/show_bug.cgi?id=261099 rdar://114839348 Reviewed by Jean-Yves Avenard. Make WebRTC codec checks case insensitive, which follows what other browsers are doing. Add a WebRTC test case to cover this case. Keep doing case sensitive checks for WebCodecs and beef up WPT webcodecs tests accordingly. * LayoutTests/imported/w3c/web-platform-tests/webcodecs/video-decoder.https.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/webcodecs/video-decoder.https.any.js: * LayoutTests/imported/w3c/web-platform-tests/webcodecs/video-decoder.https.any.worker-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/webcodecs/video-encoder-config.https.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/webcodecs/video-encoder-config.https.any.js: * LayoutTests/imported/w3c/web-platform-tests/webcodecs/video-encoder-config.https.any.worker-expected.txt: * LayoutTests/webrtc/video-lowercase-media-subtype-expected.txt: Added. * LayoutTests/webrtc/video-lowercase-media-subtype.html: Added. * LayoutTests/platform/glib/TestExpectations: * Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp: (WebKit::createVideoDecoder): (WebKit::createVideoEncoder): Canonical link: https://commits.webkit.org/267637@main
- Loading branch information
Showing
10 changed files
with
122 additions
and
6 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
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
5 changes: 5 additions & 0 deletions
5
LayoutTests/webrtc/video-lowercase-media-subtype-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,5 @@ | ||
|
||
|
||
PASS Video exchange with lower case h264 on encoding side | ||
PASS Video exchange with lower case h264 on decoding side | ||
|
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,83 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Lowercase media subtype name in SDP</title> | ||
<script src="../resources/testharness.js"></script> | ||
<script src="../resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<video id="video1" playsinline autoplay=""></video> | ||
<video id="video2" playsinline autoplay=""></video> | ||
<script> | ||
promise_test(async (test) => { | ||
const localStream = await navigator.mediaDevices.getUserMedia({video:true }); | ||
|
||
const pc1 = new RTCPeerConnection(); | ||
const pc2 = new RTCPeerConnection(); | ||
|
||
pc2.addTrack(localStream.getVideoTracks()[0], localStream); | ||
pc1.addTransceiver("video", {direction:"recvonly"}); | ||
|
||
const codecs = RTCRtpSender.getCapabilities("video").codecs; | ||
const h264Codec = codecs.filter(codec => { return codec.mimeType === "video/H264"; })[0]; | ||
pc1.getTransceivers().forEach((transceiver) => { transceiver.setCodecPreferences([h264Codec]); }); | ||
|
||
pc1.onicecandidate = (e) => pc2.addIceCandidate(e.candidate); | ||
pc2.onicecandidate = (e) => pc1.addIceCandidate(e.candidate); | ||
|
||
await pc1.setLocalDescription(); | ||
let desc = pc1.localDescription; | ||
|
||
const regex = /H264/i; | ||
desc.sdp = desc.sdp.replace(regex, "h264"); | ||
await pc2.setRemoteDescription(desc); | ||
|
||
const answer = await pc2.createAnswer(); | ||
await pc1.setRemoteDescription(answer); | ||
|
||
answer.sdp = answer.sdp.replace(regex, "h264"); | ||
await pc2.setLocalDescription(answer); | ||
|
||
video1.srcObject = new MediaStream([pc1.getReceivers()[0].track]); | ||
await video1.play(); | ||
}, "Video exchange with lower case h264 on encoding side"); | ||
|
||
promise_test(async (test) => { | ||
const localStream = await navigator.mediaDevices.getUserMedia({video:true }); | ||
|
||
const pc1 = new RTCPeerConnection(); | ||
const pc2 = new RTCPeerConnection(); | ||
|
||
pc1.addTrack(localStream.getVideoTracks()[0], localStream); | ||
const remoteStreamPromise = new Promise((resolve, reject) => { | ||
pc2.ontrack = (e) => resolve(e.streams[0]); | ||
setTimeout(() => reject("no remote track"), 5000); | ||
}); | ||
|
||
const codecs = RTCRtpSender.getCapabilities("video").codecs; | ||
const h264Codec = codecs.filter(codec => { return codec.mimeType === "video/H264"; })[0]; | ||
pc1.getTransceivers().forEach((transceiver) => { transceiver.setCodecPreferences([h264Codec]); }); | ||
|
||
pc1.onicecandidate = (e) => pc2.addIceCandidate(e.candidate); | ||
pc2.onicecandidate = (e) => pc1.addIceCandidate(e.candidate); | ||
|
||
await pc1.setLocalDescription(); | ||
let desc = pc1.localDescription; | ||
|
||
const regex = /H264/i; | ||
desc.sdp = desc.sdp.replace(regex, "h264"); | ||
await pc2.setRemoteDescription(desc); | ||
|
||
const answer = await pc2.createAnswer(); | ||
await pc1.setRemoteDescription(answer); | ||
|
||
answer.sdp = answer.sdp.replace(regex, "h264"); | ||
await pc2.setLocalDescription(answer); | ||
|
||
video2.srcObject = await remoteStreamPromise; | ||
await video2.play(); | ||
}, "Video exchange with lower case h264 on decoding side"); | ||
</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