|
29 | 29 | areArrayBuffersEqual(frame1.data, frame2.data);
|
30 | 30 | }
|
31 | 31 |
|
32 |
| -promise_test(async t => { |
| 32 | +async function doInverseSignalingHandshake(pc1, pc2) { |
| 33 | + const offer = await pc2.createOffer({offerToReceiveAudio: true, offerToReceiveVideo: true}); |
| 34 | + await pc1.setRemoteDescription(offer); |
| 35 | + await pc2.setLocalDescription(offer); |
| 36 | + |
| 37 | + const answer = await pc1.createAnswer(); |
| 38 | + await pc2.setRemoteDescription(answer); |
| 39 | + await pc1.setLocalDescription(answer); |
| 40 | +} |
| 41 | + |
| 42 | +async function testVideoFlow(t, negotiationFunction) { |
33 | 43 | const caller = new RTCPeerConnection({forceEncodedVideoInsertableStreams:true});
|
34 | 44 | t.add_cleanup(() => caller.close());
|
35 | 45 | const callee = new RTCPeerConnection({forceEncodedVideoInsertableStreams:true});
|
|
87 | 97 | });
|
88 | 98 |
|
89 | 99 | exchangeIceCandidates(caller, callee);
|
90 |
| - await doSignalingHandshake(caller, callee); |
| 100 | + await negotiationFunction(caller, callee); |
| 101 | + |
91 | 102 | // Pass frames as they come from the encoder.
|
92 | 103 | for (let i = 0; i < numFramesPassthrough; i++) {
|
93 | 104 | const result = await senderReader.read()
|
|
117 | 128 | frameInfos.push({timestamp: result.value.timestamp, data: result.value.data});
|
118 | 129 | senderWriter.write(result.value);
|
119 | 130 | }
|
| 131 | +} |
| 132 | + |
| 133 | +promise_test(async t => { |
| 134 | + return testVideoFlow(t, doSignalingHandshake); |
120 | 135 | }, 'Frames flow correctly using insertable streams');
|
121 | 136 |
|
| 137 | +promise_test(async t => { |
| 138 | + return testVideoFlow(t, doInverseSignalingHandshake); |
| 139 | +}, 'Frames flow correctly using insertable streams when receiver starts negotiation'); |
| 140 | + |
122 | 141 | promise_test(async t => {
|
123 | 142 | const caller = new RTCPeerConnection();
|
124 | 143 | t.add_cleanup(() => caller.close());
|
|
0 commit comments