+++ This bug was initially created as a clone of Bug #1765005 +++ Detected on [Mon, Apr 18, 17:04:23 try](https://treeherder.mozilla.org/jobs?repo=try&revision=a44ff0b97ca670f8f1bb0b5cd9d60aff0666e5b5&selectedTaskRun=MZmzc5AMTiSkO_aBY8Wqxw.0) of patch in bug 1765005: > TEST-UNEXPECTED-FAIL | dom/media/webrtc/tests/mochitests/test_peerConnection_audioChannels.html | Error testing that PCMU with 1000 channel(s) is ignored and produces 1 channels: TypeError: can't access property "codecId", inboundStat is undefined I did a fiddle version and was able to repro twice in April 10 Nightly, but am no longer able to: STRs: - Open https://jsfiddle.net/jib1/zap5f3h2/12/ Expected results: - No errors in web console Actual result: - Error testing that PCMU with 1000 channel(s) is ignored and produces 1 channels: TypeError: can't access property "codecId", inboundStat is undefined The error happens here: ```js await new Promise(r => receiver.track.onunmute = r); const stats = await receiver.getStats(); const inboundStat = [...stats.values()].find(({type}) => type == "inbound-rtp"); => const codecStat = stats.get(inboundStat.codecId); // inboundStat is undefined ``` ...because getStats produces stats without `"inbound-rtp"`. This seems to be a race. Waiting for the unmute event is supposed to be the only surefire way to ensure stats are available (in spite of compat issues in [w3c/webrtc-stats#619](https://github.com/w3c/webrtc-stats/issues/619)). ### Spec support: unmute must fire in a queued task *after* *"[an RTCRtpReceiver receives data on an RTP source](https://w3c.github.io/webrtc-pc/#mediastreamtrack-network-use)"*, and `inbound-rtp` is *"[Statistics for an inbound](https://w3c.github.io/webrtc-stats/#dom-rtcstatstype-inbound-rtp) [RTP stream](https://w3c.github.io/webrtc-stats/#dfn-rtp-stream)"*.
Bug 1765215 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
+++ This bug was initially created as a clone of Bug #1765005 +++ Detected on [Mon, Apr 18, 17:04:23 try](https://treeherder.mozilla.org/jobs?repo=try&revision=a44ff0b97ca670f8f1bb0b5cd9d60aff0666e5b5&selectedTaskRun=MZmzc5AMTiSkO_aBY8Wqxw.0) of patch in bug 1765005: > TEST-UNEXPECTED-FAIL | dom/media/webrtc/tests/mochitests/test_peerConnection_audioChannels.html | Error testing that PCMU with 1000 channel(s) is ignored and produces 1 channels: TypeError: can't access property "codecId", inboundStat is undefined I did a fiddle version and was able to repro twice in April 10 Nightly, but am no longer able to: STRs: - Open https://jsfiddle.net/jib1/zap5f3h2/12/ Expected results: - No errors in web console Actual result: - Error testing that PCMU with 1000 channel(s) is ignored and produces 1 channels: TypeError: can't access property "codecId", inboundStat is undefined The error happens here: ```js await new Promise(r => receiver.track.onunmute = r); const stats = await receiver.getStats(); const inboundStat = [...stats.values()].find(({type}) => type == "inbound-rtp"); => const codecStat = stats.get(inboundStat.codecId); // inboundStat is undefined ``` ...because getStats produces stats without `"inbound-rtp"`. This seems to be a race. Waiting for the unmute event is supposed to be the only surefire way to ensure stats are available (in spite of compat issues in [w3c/webrtc-stats#619](https://github.com/w3c/webrtc-stats/issues/619)). ### Spec support: unmute must fire in a queued task *after* *"[an RTCRtpReceiver receives data on an RTP source](https://w3c.github.io/webrtc-pc/#mediastreamtrack-network-use)"*, and `inbound-rtp` is *"[Statistics for an inbound](https://w3c.github.io/webrtc-stats/#dom-rtcstatstype-inbound-rtp) [RTP stream](https://w3c.github.io/webrtc-stats/#dfn-rtp-stream) that is currently received"*.
+++ This bug was initially created as a clone of Bug #1765005 +++ Detected on [Mon, Apr 18, 17:04:23 try](https://treeherder.mozilla.org/jobs?repo=try&revision=a44ff0b97ca670f8f1bb0b5cd9d60aff0666e5b5&selectedTaskRun=MZmzc5AMTiSkO_aBY8Wqxw.0) of patch in bug 1765005: > TEST-UNEXPECTED-FAIL | dom/media/webrtc/tests/mochitests/test_peerConnection_audioChannels.html | Error testing that PCMU with 1000 channel(s) is ignored and produces 1 channels: TypeError: can't access property "codecId", inboundStat is undefined I did a fiddle version and was able to repro twice in April 10 Nightly on macOS, but am no longer able to: STRs: - Open https://jsfiddle.net/jib1/zap5f3h2/12/ Expected results: - No errors in web console Actual result: - Error testing that PCMU with 1000 channel(s) is ignored and produces 1 channels: TypeError: can't access property "codecId", inboundStat is undefined The error happens here: ```js await new Promise(r => receiver.track.onunmute = r); const stats = await receiver.getStats(); const inboundStat = [...stats.values()].find(({type}) => type == "inbound-rtp"); => const codecStat = stats.get(inboundStat.codecId); // inboundStat is undefined ``` ...because getStats produces stats without `"inbound-rtp"`. This seems to be a race. Waiting for the unmute event is supposed to be the only surefire way to ensure stats are available (in spite of compat issues in [w3c/webrtc-stats#619](https://github.com/w3c/webrtc-stats/issues/619)). ### Spec support: unmute must fire in a queued task *after* *"[an RTCRtpReceiver receives data on an RTP source](https://w3c.github.io/webrtc-pc/#mediastreamtrack-network-use)"*, and `inbound-rtp` is *"[Statistics for an inbound](https://w3c.github.io/webrtc-stats/#dom-rtcstatstype-inbound-rtp) [RTP stream](https://w3c.github.io/webrtc-stats/#dfn-rtp-stream) that is currently received"*.