Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove track/stream stats in favor of RTCMediaHandlerStats.mid #365

Closed
jan-ivar opened this issue Sep 6, 2018 · 3 comments
Closed

Remove track/stream stats in favor of RTCMediaHandlerStats.mid #365

jan-ivar opened this issue Sep 6, 2018 · 3 comments

Comments

@jan-ivar
Copy link
Member

jan-ivar commented Sep 6, 2018

@karthikbr82 said in #361 (comment):

if we are moving "tracks" [to the] Obsolete stats section then we could do the same for "stream".

👍 I suspect "stream" stats existed to help locate relevant stats from a media starting point. This made sense when pc.addStream was the media hand-off API. E.g.

pc.addStream(stream);
await negotiate();
const stats = await pc.getStats();
const streamStat = [...stats.values()]
  .find(stat => stat.type == "stream" && stat.streamIdentifier == stream.id);
const [senderStat] = streamStat.trackIds.map(id => stats.get(id));

These days, it's probably more helpful to start from a track:

pc.addTransceiver(track);
await negotiate();
const senderStat = [...(await pc.getStats()).values()]
  .find(stat => stat.type == "sender" && stat.trackIdentifier == track.id);

But the track isn't stable (may be changed with replaceTrack); the transceiver.mid is. So better:

const transceiver = pc.addTransceiver(track);
await negotiate();
const senderStat = [...(await pc.getStats()).values()]
  .find(stat => stat.type == "sender" && stat.mid == transceiver.mid);

Of course transceiver.sender.getStats() works, but sometimes we need to navigate the big one.

@jan-ivar jan-ivar changed the title Replace "stream" stats with RTCMediaHandlerStats.mid Remove track/stream stats in favor of RTCMediaHandlerStats.mid Sep 12, 2018
@henbos henbos added TPAC 2019 and removed TPAC 2019 labels Sep 6, 2019
@henbos
Copy link
Collaborator

henbos commented Sep 20, 2019

TPAC decision: remove "track" and "stream" stats in favor of "mid"; don't need to add streamIdentifiers because that is knowable by other means and not very relevant to stats (if someone want that that should be filed separately).

@henbos henbos assigned henbos and unassigned jan-ivar Sep 20, 2019
@henbos
Copy link
Collaborator

henbos commented Sep 22, 2019

This issue will be inblocked by #498 which exposes the mid on the "transceiver" stats.

@henbos
Copy link
Collaborator

henbos commented Jan 15, 2020

Not sure which PR, but the "stream" stats have already been made obsolete (link) and making "track" obsolete is tracked in issue #479. Closing this one.

@henbos henbos closed this as completed Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants