diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/webrtc/tests/mochitests/test_peerConnection_twoAudioVideoStreamsCombinedNoBundle.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_peerConnection_twoAudioVideoStreamsCombinedNoBundle.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_peerConnection_twoAudioVideoStreamsCombinedNoBundle.html | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_twoAudioVideoStreamsCombinedNoBundle.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_twoAudioVideoStreamsCombinedNoBundle.html new file mode 100644 index 0000000000..8b825db617 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_twoAudioVideoStreamsCombinedNoBundle.html @@ -0,0 +1,107 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> + <script type="application/javascript" src="stats.js"></script> +</head> +<body> +<pre id="test"> +<script type="application/javascript"> +createHTML({ + bug: "1225722", + title: "Multistream: Two audio/video streams without BUNDLE" +}); + +runNetworkTest(async (options = {}) => { + // Disable platform encodre for SW MFT encoder causes some stats + // exceeding the test thresholds. + // E.g. inbound-rtp.packetsDiscarded value=118 >= 100. + await matchPlatformH264CodecPrefs(); + + options.bundle = false; + const test = new PeerConnectionTest(options); + test.setMediaConstraints( + [{audio: true, video: true}, {audio: true, video: true}], + [{audio: true, video: true}, {audio: true, video: true}] + ); + + // Test stats, including that codec stats do not coalesce without BUNDLE. + const testNonBundledStats = async pc => { + // This is basically PC_*_TEST_*_STATS fleshed out, but uses + // sender/receiver.getStats instead of pc.getStats, since the codec stats + // code assumes at most one sender and at most one receiver. + await waitForSyncedRtcp(pc); + const senderPromises = pc.getSenders().map(obj => obj.getStats()); + const receiverPromises = pc.getReceivers().map(obj => obj.getStats()); + const senderStats = await Promise.all(senderPromises); + const receiverStats = await Promise.all(receiverPromises); + for (const stats of [...senderStats, ...receiverStats]) { + checkExpectedFields(stats); + pedanticChecks(stats); + } + for (const stats of senderStats) { + checkSenderStats(stats, 1); + } + }; + + test.chain.insertAfter("PC_LOCAL_WAIT_FOR_MEDIA_FLOW", [ + async function PC_LOCAL_TEST_LOCAL_NONBUNDLED_STATS(test) { + await testNonBundledStats(test.pcLocal._pc); + }, + ]); + + test.chain.insertAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW", [ + async function PC_REMOTE_TEST_LOCAL_NONBUNDLED_STATS(test) { + await testNonBundledStats(test.pcRemote._pc); + }, + ]); + + const testNonCoalescedCodecStats = stats => { + const codecs = [...stats.values()] + .filter(({type}) => type == "codec"); + is([...stats.values()].filter(({type}) => type.endsWith("rtp")).length, 16, + "Expected: 4 outbound, 4 remote-inbound, 4 inbound, 4 remote-inbound"); + const codecTypes = new Set(codecs.map(({codecType}) => codecType)); + is(codecTypes.size, 1, + "Should have identical encode and decode configurations (and stats)"); + is(codecTypes[0], undefined, + "Should have identical encode and decode configurations (and stats)"); + const transportIds = new Set(codecs.map(({transportId}) => transportId)); + is(transportIds.size, 4, + "Should have registered four transports for two sendrecv streams"); + for (const transportId of transportIds) { + is(codecs.filter(c => c.transportId == transportId).length, 1, + "Should have registered one codec per transport without BUNDLE"); + } + for (const prefix of ["audio", "video"]) { + const prefixed = codecs.filter(c => c.mimeType.startsWith(prefix)); + is(prefixed.length, 2, `Should have registered two ${prefix} codecs`); + if (prefixed.length == 2) { + is(prefixed[0].payloadType, prefixed[1].payloadType, + "same payloadType"); + isnot(prefixed[0].transportId, prefixed[1].transportId, + "different transportIds"); + is(prefixed[0].mimeType, prefixed[1].mimeType, "same mimeType"); + is(prefixed[0].clockRate, prefixed[1].clockRate, "same clockRate"); + is(prefixed[0].channels, prefixed[1].channels, "same channels"); + is(prefixed[0].sdpFmtpLine, prefixed[1].sdpFmtpLine, + "same sdpFmtpLine"); + } + } + }; + + test.chain.append([ + async function PC_LOCAL_TEST_NON_COALESCED_CODEC_STATS() { + testNonCoalescedCodecStats(await test.pcLocal._pc.getStats()); + }, + async function PC_REMOTE_TEST_NON_COALESCED_CODEC_STATS() { + testNonCoalescedCodecStats(await test.pcRemote._pc.getStats()); + }, + ]); + + return test.run(); +}); +</script> +</pre> +</body> +</html> |