Use state from the WebRTC stat reports for RTT

Previous fix #844d84b doesn't work in Chrome, so this is another method
for better FF/Chrome compatibility.
This commit is contained in:
sergystepanov 2026-06-06 22:52:53 +03:00
parent 14de2a1790
commit 6fff575817

View file

@ -642,8 +642,12 @@ stats.modules = [
);
SET_CODEC = 1;
}
const { selected, currentRoundTripTime, type, kind } = report;
if (selected && currentRoundTripTime !== undefined) {
const { selected, state, currentRoundTripTime, type, kind } =
report;
if (
(selected || state === "succeeded") &&
currentRoundTripTime !== undefined
) {
WEBRTC_STATS_RTT(currentRoundTripTime * 1000);
}
if (type === "inbound-rtp" && kind === "video") {