From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/webrtc-extensions/META.yml | 3 + .../webrtc-extensions/RTCOAuthCredential.html | 44 +++++ .../RTCRtpParameters-adaptivePtime.html | 48 +++++ .../RTCRtpParameters-maxFramerate.html | 101 ++++++++++ .../RTCRtpReceiver-playoutDelayHint.html | 113 +++++++++++ ...CRtpSynchronizationSource-captureTimestamp.html | 94 +++++++++ .../RTCRtpSynchronizationSource-helper.js | 140 +++++++++++++ ...chronizationSource-senderCaptureTimeOffset.html | 92 +++++++++ .../RTCRtpTransceiver-headerExtensionControl.html | 219 +++++++++++++++++++++ .../transfer-datachannel-service-worker.https.html | 83 ++++++++ .../transfer-datachannel-service-worker.js | 15 ++ .../transfer-datachannel-worker.js | 19 ++ .../webrtc-extensions/transfer-datachannel.html | 165 ++++++++++++++++ 13 files changed, 1136 insertions(+) create mode 100644 testing/web-platform/tests/webrtc-extensions/META.yml create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCOAuthCredential.html create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-adaptivePtime.html create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-captureTimestamp.html create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-helper.js create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-senderCaptureTimeOffset.html create mode 100644 testing/web-platform/tests/webrtc-extensions/RTCRtpTransceiver-headerExtensionControl.html create mode 100644 testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.https.html create mode 100644 testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js create mode 100644 testing/web-platform/tests/webrtc-extensions/transfer-datachannel-worker.js create mode 100644 testing/web-platform/tests/webrtc-extensions/transfer-datachannel.html (limited to 'testing/web-platform/tests/webrtc-extensions') diff --git a/testing/web-platform/tests/webrtc-extensions/META.yml b/testing/web-platform/tests/webrtc-extensions/META.yml new file mode 100644 index 0000000000..be8cb028f0 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/META.yml @@ -0,0 +1,3 @@ +spec: https://w3c.github.io/webrtc-extensions/ +suggested_reviewers: + - hbos diff --git a/testing/web-platform/tests/webrtc-extensions/RTCOAuthCredential.html b/testing/web-platform/tests/webrtc-extensions/RTCOAuthCredential.html new file mode 100644 index 0000000000..63e92c6d08 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCOAuthCredential.html @@ -0,0 +1,44 @@ + + +RTCConfiguration iceServers with OAuth credentials + + + + diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-adaptivePtime.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-adaptivePtime.html new file mode 100644 index 0000000000..a0cc989c13 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-adaptivePtime.html @@ -0,0 +1,48 @@ + + +RTCRtpEncodingParameters adaptivePtime property + + + diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html new file mode 100644 index 0000000000..3e348f0d14 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html @@ -0,0 +1,101 @@ + + +RTCRtpParameters encodings + + + + + diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html new file mode 100644 index 0000000000..29dfc19a6b --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpReceiver-playoutDelayHint.html @@ -0,0 +1,113 @@ + + +Tests for RTCRtpReceiver-playoutDelayHint attribute + + + + + + diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-captureTimestamp.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-captureTimestamp.html new file mode 100644 index 0000000000..60b4ed0a74 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-captureTimestamp.html @@ -0,0 +1,94 @@ + + + + +captureTimestamp attribute in RTCRtpSynchronizationSource +
+ + + + + + diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-helper.js b/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-helper.js new file mode 100644 index 0000000000..10cfd65155 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-helper.js @@ -0,0 +1,140 @@ +'use strict'; + +// This file depends on `webrtc/RTCPeerConnection-helper.js` +// which should be loaded from the main HTML file. + +var kAbsCaptureTime = + 'http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time'; + +function addHeaderExtensionToSdp(sdp, uri) { + const extmap = new RegExp('a=extmap:(\\d+)'); + let sdpLines = sdp.split('\r\n'); + + // This assumes at most one audio m= section and one video m= section. + // If more are present, only the first section of each kind is munged. + for (const section of ['audio', 'video']) { + let found_section = false; + let maxId = undefined; + let maxIdLine = undefined; + let extmapAllowMixed = false; + + // find the largest header extension id for section. + for (let i = 0; i < sdpLines.length; ++i) { + if (!found_section) { + if (sdpLines[i].startsWith('m=' + section)) { + found_section = true; + } + continue; + } else { + if (sdpLines[i].startsWith('m=')) { + // end of section + break; + } + } + + if (sdpLines[i] === 'a=extmap-allow-mixed') { + extmapAllowMixed = true; + } + let result = sdpLines[i].match(extmap); + if (result && result.length === 2) { + if (maxId == undefined || result[1] > maxId) { + maxId = parseInt(result[1]); + maxIdLine = i; + } + } + } + + if (maxId == 14 && !extmapAllowMixed) { + // Reaching the limit of one byte header extension. Adding two byte header + // extension support. + sdpLines.splice(maxIdLine + 1, 0, 'a=extmap-allow-mixed'); + } + if (maxIdLine !== undefined) { + sdpLines.splice(maxIdLine + 1, 0, + 'a=extmap:' + (maxId + 1).toString() + ' ' + uri); + } + } + return sdpLines.join('\r\n'); +} + +// TODO(crbug.com/1051821): Use RTP header extension API instead of munging +// when the RTP header extension API is implemented. +async function addAbsCaptureTimeAndExchangeOffer(caller, callee) { + let offer = await caller.createOffer(); + + // Absolute capture time header extension may not be offered by default, + // in such case, munge the SDP. + offer.sdp = addHeaderExtensionToSdp(offer.sdp, kAbsCaptureTime); + + await caller.setLocalDescription(offer); + return callee.setRemoteDescription(offer); +} + +// TODO(crbug.com/1051821): Use RTP header extension API instead of munging +// when the RTP header extension API is implemented. +async function checkAbsCaptureTimeAndExchangeAnswer(caller, callee, + absCaptureTimeAnswered) { + let answer = await callee.createAnswer(); + + const extmap = new RegExp('a=extmap:\\d+ ' + kAbsCaptureTime + '\r\n', 'g'); + if (answer.sdp.match(extmap) == null) { + // We expect that absolute capture time RTP header extension is answered. + // But if not, there is no need to proceed with the test. + assert_false(absCaptureTimeAnswered, 'Absolute capture time RTP ' + + 'header extension is not answered'); + } else { + if (!absCaptureTimeAnswered) { + // We expect that absolute capture time RTP header extension is not + // answered, but it is, then we munge the answer to remove it. + answer.sdp = answer.sdp.replace(extmap, ''); + } + } + + await callee.setLocalDescription(answer); + return caller.setRemoteDescription(answer); +} + +async function exchangeOfferAndListenToOntrack(t, caller, callee, + absCaptureTimeOffered) { + const ontrackPromise = addEventListenerPromise(t, callee, 'track'); + // Absolute capture time header extension is expected not offered by default, + // and thus munging is needed to enable it. + await absCaptureTimeOffered + ? addAbsCaptureTimeAndExchangeOffer(caller, callee) + : exchangeOffer(caller, callee); + return ontrackPromise; +} + +async function initiateSingleTrackCall(t, cap, absCaptureTimeOffered, + absCaptureTimeAnswered) { + const caller = new RTCPeerConnection(); + t.add_cleanup(() => caller.close()); + const callee = new RTCPeerConnection(); + t.add_cleanup(() => callee.close()); + + const stream = await getNoiseStream(cap); + stream.getTracks().forEach(track => { + caller.addTrack(track, stream); + t.add_cleanup(() => track.stop()); + }); + + // TODO(crbug.com/988432): `getSynchronizationSources() on the audio side + // needs a hardware sink for the returned dictionary entries to get updated. + const remoteVideo = document.getElementById('remote'); + + callee.ontrack = e => { + remoteVideo.srcObject = e.streams[0]; + } + + exchangeIceCandidates(caller, callee); + + await exchangeOfferAndListenToOntrack(t, caller, callee, + absCaptureTimeOffered); + + // Exchange answer and check whether the absolute capture time RTP header + // extension is answered. + await checkAbsCaptureTimeAndExchangeAnswer(caller, callee, + absCaptureTimeAnswered); + + return [caller, callee]; +} diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-senderCaptureTimeOffset.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-senderCaptureTimeOffset.html new file mode 100644 index 0000000000..63ad9bf888 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpSynchronizationSource-senderCaptureTimeOffset.html @@ -0,0 +1,92 @@ + + + + +senderCaptureTimeOffset attribute in RTCRtpSynchronizationSource +
+ + + + + + diff --git a/testing/web-platform/tests/webrtc-extensions/RTCRtpTransceiver-headerExtensionControl.html b/testing/web-platform/tests/webrtc-extensions/RTCRtpTransceiver-headerExtensionControl.html new file mode 100644 index 0000000000..e823bd830c --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/RTCRtpTransceiver-headerExtensionControl.html @@ -0,0 +1,219 @@ + + +RTCRtpParameters encodings + + + + + diff --git a/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.https.html b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.https.html new file mode 100644 index 0000000000..625fee4fe1 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.https.html @@ -0,0 +1,83 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js new file mode 100644 index 0000000000..c1919d0b9a --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-service-worker.js @@ -0,0 +1,15 @@ +let channel; +let port; +onmessage = (e) => { + if (e.data.port) { + port = e.data.port; + port.onmessage = (event) => channel.send(event.data.message); + } + if (e.data.channel) { + channel = e.data.channel; + channel.onopen = () => port.postMessage("opened"); + channel.onerror = () => port.postMessage("errored"); + channel.onclose = () => port.postMessage("closed"); + channel.onmessage = (event) => port.postMessage(event.data); + } +}; diff --git a/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-worker.js b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-worker.js new file mode 100644 index 0000000000..10d71f68f0 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel-worker.js @@ -0,0 +1,19 @@ +let channel; +onmessage = (event) => { + if (event.data.channel) { + channel = event.data.channel; + channel.onopen = () => self.postMessage("opened"); + channel.onerror = () => self.postMessage("errored"); + channel.onclose = () => self.postMessage("closed"); + channel.onmessage = event => self.postMessage(event.data); + } + if (event.data.message) { + if (channel) + channel.send(event.data.message); + } + if (event.data.close) { + if (channel) + channel.close(); + } +}; +self.postMessage("registered"); diff --git a/testing/web-platform/tests/webrtc-extensions/transfer-datachannel.html b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel.html new file mode 100644 index 0000000000..9759a67a24 --- /dev/null +++ b/testing/web-platform/tests/webrtc-extensions/transfer-datachannel.html @@ -0,0 +1,165 @@ + + + + + + + + + + + + -- cgit v1.2.3