|
25 | 25 | "measure raising video jitterBufferTarget to 500"); |
26 | 26 | async_promise_test(t => applyJitterBufferTarget(t, "audio", 500), |
27 | 27 | "measure raising audio jitterBufferTarget to 500"); |
28 | | -async_promise_test(t => applyJitterBufferTarget(t, "video", 250, 50), |
29 | | - "measure lowering video jitterBufferTarget to 50"); |
30 | | -async_promise_test(t => applyJitterBufferTarget(t, "audio", 250, 50), |
31 | | - "measure lowering audio jitterBufferTarget to 50"); |
32 | | -async_promise_test(t => applyJitterBufferTarget(t, "video", 500, 150), |
| 28 | +async_promise_test(t => applyJitterBufferTarget(t, "video", 250, 150), |
33 | 29 | "measure lowering video jitterBufferTarget to 150"); |
34 | | -async_promise_test(t => applyJitterBufferTarget(t, "audio", 500, 150), |
| 30 | +async_promise_test(t => applyJitterBufferTarget(t, "audio", 250, 150), |
35 | 31 | "measure lowering audio jitterBufferTarget to 150"); |
| 32 | +async_promise_test(t => applyJitterBufferTarget(t, "video", 400, 250), |
| 33 | + "measure lowering video jitterBufferTarget to 300"); |
| 34 | +async_promise_test(t => applyJitterBufferTarget(t, "audio", 400, 250), |
| 35 | + "measure lowering audio jitterBufferTarget to 300"); |
36 | 36 |
|
37 | 37 | async function applyJitterBufferTarget(t, kind, target, targetToLower) { |
38 | 38 | const caller = new RTCPeerConnection(); |
|
67 | 67 | async function measureDelayFromStats(t, receiver, callee, target, kind) { |
68 | 68 | const lowerBound = target * 0.7; |
69 | 69 | const upperBound = target * 1.3; |
70 | | - let delay, oldInboundStats; |
| 70 | + let delay, oldInboundStats, prevDelay, rateOfChange; |
| 71 | + let numDelayMeasurements = 1; |
71 | 72 |
|
72 | 73 | for (let statChecks = 0; statChecks < 40; statChecks++) { |
73 | 74 | await new Promise(r => t.step_timeout(r, 1000)); |
|
77 | 78 | if (oldInboundStats) { |
78 | 79 | delay = ((inboundStats.jitterBufferDelay - oldInboundStats.jitterBufferDelay) / |
79 | 80 | (inboundStats.jitterBufferEmittedCount - oldInboundStats.jitterBufferEmittedCount) * 1000); |
| 81 | + if (prevDelay) { |
| 82 | + rateOfChange = (delay - prevDelay) / numDelayMeasurements; |
| 83 | + numDelayMeasurements++; |
| 84 | + } |
| 85 | + prevDelay = delay; |
80 | 86 | if (delay > lowerBound && delay < upperBound) { |
81 | 87 | break; |
82 | 88 | } |
83 | 89 | } |
84 | 90 | oldInboundStats = inboundStats; |
85 | 91 | } |
86 | 92 | t.step(() => assert_between_inclusive(delay , lowerBound, upperBound, |
87 | | - `${kind} delay is within bounds`)); |
| 93 | + `${kind} delay is within bounds rateOfChange ${rateOfChange} over ${numDelayMeasurements} measurements`)); |
88 | 94 | return delay; |
89 | 95 | } |
90 | 96 | </script> |
|
0 commit comments