W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > February 2022

Re: [webrtc-stats] WPT tests are wrong about when "outbound-rtp" and "inbound-rtp" stats appear (#619)

From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
Date: Tue, 08 Feb 2022 20:24:07 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-1033028622-1644351845-sysbot+gh@w3.org>
Fyi the official way to read (non-zero) RTP stats is to wait for RTP, [like this](https://jsfiddle.net/jib1/y0k2p3of/):
```js
  pc1.addTrack((await gUM({video:true})).getTracks()[0]);
  const {track} = await new Promise(r => pc2.ontrack = r);
  await new Promise(r => track.onunmute = r);
  const stats = await pc1.getStats();
  console.log(`${[...stats.values()].filter(({type}) => type == "outbound-rtp").length} outbound-rtp`);
```
But note that due to [crbug 1295295](https://crbug.com/1295295) this would still return stats early in Chrome. 🤷🏼‍♂️


-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/webrtc-stats/issues/619#issuecomment-1033028622 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 8 February 2022 20:24:09 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:56 UTC