Skip to content

Commit

Permalink
Update Blink to use environment clock timestamps from RTCStats objects.
Browse files Browse the repository at this point in the history
https://webrtc-review.googlesource.com/c/src/+/363946 added a config flag to tell WebRTC to set environment clock timestamps in RTCStats objects (rather then UTC timestamps). This CL set the config flag, and update the code to handle the new timestamps.

This change make all RTCStats timestamps be expressed as Performance time, fixing chromium:369369568.

Bug: chromium:369369568
Change-Id: Icc991ba55543bf13a17b526a1247043551e85bab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5920098
Commit-Queue: Olov Brändström <brandstrom@chromium.org>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Henrik Boström <hbos@chromium.org>
Reviewed-by: Johannes Kron <kron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1368191}
  • Loading branch information
Olov Brändström authored and chromium-wpt-export-bot committed Oct 14, 2024
1 parent 598e86a commit a2dc005
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions webrtc/RTCPeerConnection-getStats-timestamp.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
// performance.now()` diverge inside of WPTs, so implementers beware that these
// tests may give FALSE positives if `timestamp` is implemented as Wall Clock.

// TODO: crbug.com/372749742 - Timestamps from RTCStats differs slightly from
// performance.timeOrigin + performance.now(). We add an epsilon to the
// timestamp checks as a workaround to avoid making the tests flaky.
const kTimeEpsilon = 0.2;

promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
Expand All @@ -25,8 +30,10 @@
const peerConnectionStats =
report.values().find(stats => stats.type == 'peer-connection');

assert_less_than_equal(t0, peerConnectionStats.timestamp);
assert_less_than_equal(peerConnectionStats.timestamp, t1);
assert_less_than_equal(t0, peerConnectionStats.timestamp + kTimeEpsilon,
't0 < timestamp');
assert_less_than_equal(peerConnectionStats.timestamp, t1 + kTimeEpsilon,
'timestamp < t1');
}, 'RTCStats.timestamp is expressed as Performance time');

promise_test(async t => {
Expand Down Expand Up @@ -63,7 +70,9 @@
}
const t1 = performance.timeOrigin + performance.now();

assert_less_than_equal(t0, remoteInboundRtp.timestamp);
assert_less_than_equal(remoteInboundRtp.timestamp, t1);
assert_less_than_equal(t0, remoteInboundRtp.timestamp + kTimeEpsilon,
't0 < timestamp');
assert_less_than_equal(remoteInboundRtp.timestamp, t1 + kTimeEpsilon,
'timestamp < t1');
}, 'RTCRemoteInboundRtpStats.timestamp is expressed as Performance time');
</script>

0 comments on commit a2dc005

Please sign in to comment.