Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (266507 => 266508)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-09-03 08:07:48 UTC (rev 266507)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-09-03 08:38:50 UTC (rev 266508)
@@ -1,3 +1,14 @@
+2020-09-03 Youenn Fablet <you...@apple.com>
+
+ calling transceiver setCodecPreferences doesn't change the order of codecs in the offer/answer generated by the browser
+ https://bugs.webkit.org/show_bug.cgi?id=215567
+ <rdar://problem/67277554>
+
+ Reviewed by Eric Carlson.
+
+ * web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt:
+ * web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences.html:
+
2020-09-02 Alex Christensen <achristen...@webkit.org>
Remove some unused old expectations files
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt (266507 => 266508)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt 2020-09-03 08:07:48 UTC (rev 266507)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences-expected.txt 2020-09-03 08:38:50 UTC (rev 266508)
@@ -4,13 +4,16 @@
PASS setCodecPreferences() with both sender receiver codecs combined should succeed
PASS setCodecPreferences([]) should succeed
PASS setCodecPreferences() with reordered codecs should succeed
-PASS setCodecPreferences() with only one video codec should succeed
-FAIL setCodecPreferences() on audio transceiver with codecs returned from getCapabilities('video') should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(capabilities.codecs)" did not throw
-FAIL setCodecPreferences() with user defined codec with invalid mimeType should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(codecs)" did not throw
-FAIL setCodecPreferences() with user defined codec should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(codecs)" did not throw
-FAIL setCodecPreferences() with user defined codec together with codecs returned from getCapabilities() should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(codecs)" did not throw
-FAIL setCodecPreferences() with modified codec clock rate should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(codecs)" did not throw
-FAIL setCodecPreferences() with modified codec channel count should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(codecs)" did not throw
-FAIL setCodecPreferences() with modified codec parameters should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(codecs)" did not throw
-FAIL setCodecPreferences() with modified codecs returned from getCapabilities() should throw InvalidModificationError assert_throws_dom: function "() => transceiver.setCodecPreferences(codecs)" did not throw
+PASS setCodecPreferences() with only VP8 should succeed
+PASS setCodecPreferences() with only H264 should succeed
+PASS setCodecPreferences() should allow setting H264 as first codec
+PASS setCodecPreferences() should allow setting VP8 as first codec
+PASS setCodecPreferences() on audio transceiver with codecs returned from getCapabilities('video') should throw InvalidModificationError
+PASS setCodecPreferences() with user defined codec with invalid mimeType should throw InvalidModificationError
+PASS setCodecPreferences() with user defined codec should throw InvalidModificationError
+PASS setCodecPreferences() with user defined codec together with codecs returned from getCapabilities() should throw InvalidModificationError
+PASS setCodecPreferences() with modified codec clock rate should throw InvalidModificationError
+PASS setCodecPreferences() with modified codec channel count should throw InvalidModificationError
+PASS setCodecPreferences() with modified codec parameters should throw InvalidModificationError
+PASS setCodecPreferences() with modified codecs returned from getCapabilities() should throw InvalidModificationError
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences.html (266507 => 266508)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences.html 2020-09-03 08:07:48 UTC (rev 266507)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences.html 2020-09-03 08:38:50 UTC (rev 266508)
@@ -92,10 +92,59 @@
}
});
assert_true(tried, 'VP8 video codec was found and tried');
- }, `setCodecPreferences() with only one video codec should succeed`);
+ }, `setCodecPreferences() with only VP8 should succeed`);
test(() => {
const pc = new RTCPeerConnection();
+ const transceiver = pc.addTransceiver('video');
+ const capabilities = RTCRtpSender.getCapabilities('video');
+ const { codecs } = capabilities;
+ // This test verifies that the mandatory H264 codec is present
+ // and can be set.
+ let tried = false;
+ codecs.forEach(codec => {
+ if (codec.mimeType.toLowerCase() === 'video/h264') {
+ transceiver.setCodecPreferences([codecs[0]]);
+ tried = true;
+ }
+ });
+ assert_true(tried, 'VP8 video codec was found and tried');
+ }, `setCodecPreferences() with only H264 should succeed`);
+
+ async function getRTPMapLinesWithCodecAsFirst(firstCodec)
+ {
+ const capabilities = RTCRtpSender.getCapabilities('video').codecs;
+ capabilities.forEach((codec, idx) => {
+ if (codec.mimeType === firstCodec) {
+ capabilities.splice(idx, 1);
+ capabilities.unshift(codec);
+ }
+ });
+
+ const pc = new RTCPeerConnection();
+ const transceiver = pc.addTransceiver('video');
+ transceiver.setCodecPreferences(capabilities);
+ const offer = await pc.createOffer();
+
+ return offer.sdp.split('\r\n').filter(line => line.indexOf("a=rtpmap") === 0);
+ }
+
+ promise_test(async () => {
+ const lines = await getRTPMapLinesWithCodecAsFirst('video/H264');
+
+ assert_greater_than(lines.length, 1);
+ assert_true(lines[0].indexOf("H264") !== -1, "H264 should be the first codec");
+ }, `setCodecPreferences() should allow setting H264 as first codec`);
+
+ promise_test(async () => {
+ const lines = await getRTPMapLinesWithCodecAsFirst('video/VP8');
+
+ assert_greater_than(lines.length, 1);
+ assert_true(lines[0].indexOf("VP8") !== -1, "VP8 should be the first codec");
+ }, `setCodecPreferences() should allow setting VP8 as first codec`);
+
+ test(() => {
+ const pc = new RTCPeerConnection();
const transceiver = pc.addTransceiver('audio');
const capabilities = RTCRtpSender.getCapabilities('video');
assert_throws_dom('InvalidModificationError', () => transceiver.setCodecPreferences(capabilities.codecs));
Modified: trunk/Source/WebCore/ChangeLog (266507 => 266508)
--- trunk/Source/WebCore/ChangeLog 2020-09-03 08:07:48 UTC (rev 266507)
+++ trunk/Source/WebCore/ChangeLog 2020-09-03 08:38:50 UTC (rev 266508)
@@ -1,3 +1,20 @@
+2020-09-03 Youenn Fablet <you...@apple.com>
+
+ calling transceiver setCodecPreferences doesn't change the order of codecs in the offer/answer generated by the browser
+ https://bugs.webkit.org/show_bug.cgi?id=215567
+ <rdar://problem/67277554>
+
+ Reviewed by Eric Carlson.
+
+ Make sure to serialize sdpFmtp information so that setCodecPreferences succeeds.
+ Also make sure to throw the exception if there is any.
+
+ Covered by updated imported/w3c/web-platform-tests/webrtc/RTCRtpTransceiver-setCodecPreferences.html.
+
+ * Modules/mediastream/RTCRtpTransceiver.idl:
+ * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
+ (WebCore::toRTCRtpCapabilities):
+
2020-09-02 Chris Dumez <cdu...@apple.com>
Choose adequate number of channels for ConvolverNode's output
Modified: trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl (266507 => 266508)
--- trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl 2020-09-03 08:07:48 UTC (rev 266507)
+++ trunk/Source/WebCore/Modules/mediastream/RTCRtpTransceiver.idl 2020-09-03 08:38:50 UTC (rev 266508)
@@ -42,5 +42,5 @@
attribute RtpTransceiverDirection direction;
readonly attribute RTCRtpTransceiverDirection? currentDirection;
undefined stop();
- undefined setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
+ [MayThrowException] undefined setCodecPreferences(sequence<RTCRtpCodecCapability> codecs);
};
Modified: trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp (266507 => 266508)
--- trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2020-09-03 08:07:48 UTC (rev 266507)
+++ trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp 2020-09-03 08:38:50 UTC (rev 266508)
@@ -399,8 +399,20 @@
RTCRtpCapabilities capabilities;
capabilities.codecs.reserveInitialCapacity(rtpCapabilities.codecs.size());
- for (auto& codec : rtpCapabilities.codecs)
- capabilities.codecs.uncheckedAppend(RTCRtpCodecCapability { fromStdString(codec.mime_type()), static_cast<uint32_t>(codec.clock_rate ? *codec.clock_rate : 0), toChannels(codec.num_channels), { } });
+ for (auto& codec : rtpCapabilities.codecs) {
+ StringBuilder sdpFmtpLine;
+ bool hasParameter = false;
+ for (auto& parameter : codec.parameters) {
+ if (hasParameter)
+ sdpFmtpLine.append(";");
+ else
+ hasParameter = true;
+ sdpFmtpLine.append(StringView(parameter.first.data(), parameter.first.length()));
+ sdpFmtpLine.append("=");
+ sdpFmtpLine.append(StringView(parameter.second.data(), parameter.second.length()));
+ }
+ capabilities.codecs.uncheckedAppend(RTCRtpCodecCapability { fromStdString(codec.mime_type()), static_cast<uint32_t>(codec.clock_rate ? *codec.clock_rate : 0), toChannels(codec.num_channels), sdpFmtpLine.toString() });
+ }
capabilities.headerExtensions.reserveInitialCapacity(rtpCapabilities.header_extensions.size());
for (auto& header : rtpCapabilities.header_extensions)