webrtc-stats icon indicating copy to clipboard operation
webrtc-stats copied to clipboard

Finding associated audio and video tracks?

Open WeichengSu opened this issue 4 years ago • 7 comments

According to the definition of estimatedPlayoutTimestamp, we can use audioTrackStats.estimatedPlayoutTimestamp - videoTrackStats.estimatedPlayoutTimestamp to get the AV sync. https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-estimatedplayouttimestamp

I have been using trackIds in RTCMediaStreamStats to find the associated audio and video tracks. https://w3c.github.io/webrtc-stats/#idl-def-rtcmediastreamstats However, it's made obsolete. What's the recommended way to find the associated audio and video tracks without RTCMediaStreamStats?

WeichengSu avatar Jun 03 '20 03:06 WeichengSu

When you say "associated", do you mean the tracks that the platform will try to keep in sync (by including them in a MediaStreamTrack)? Applications are trying to keep track of A/V differences between tracks that aren't in a MediaStreamTrack - in that case, the stream stats wouldn't help you.

Can you explain more about what the use case is that you need this association for?

alvestrand avatar Jun 03 '20 13:06 alvestrand

Yes. I meant the tracks that the platform should try to keep in sync. We want to monitor the av sync of the two tracks (using estimatedPlayoutTimestamp https://w3c.github.io/webrtc-stats/#dom-rtcinboundrtpstreamstats-estimatedplayouttimestamp)

WeichengSu avatar Jun 11 '20 05:06 WeichengSu

are these tracks using the same CNAME? otherwise clocks might be different and hinder any A/V sync calculations.

vr000m avatar Aug 12 '20 13:08 vr000m

According to spec, all tracks sourced from the same WebRTC implementation use the same CNAME.

alvestrand avatar Aug 25 '20 12:08 alvestrand

Two possible changes:

  • Add a MediaStreamIdentifier array to "sender" and "receiver" object
  • Un-obsolete the MediaStreamStats object.

The latter is unpalatable because it is defined as pointing to (obsolete) Track stats objects.

alvestrand avatar Sep 08 '20 13:09 alvestrand

The way to do this now is to listen to "RTCPeerConnection.ontrack". But if it is useful to tell this from a getStats call, we could add them like @alvestrand said above.

henbos avatar Sep 08 '20 13:09 henbos

Proposal: add streamIdentifiers (DOMString array) to "sender" and "receiver"

henbos avatar Sep 08 '20 13:09 henbos