microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
913 stars 283 forks source link

Get RTT for each Peer Connection #408

Open eirikhollis opened 4 years ago

eirikhollis commented 4 years ago

Describe the problem There are many cases where one would want to know the round-trip delay time on each connection in WebRTC. If I'm not entirely mistaken, none of the built-in delay statistics in WebRTC are brought forwards to the C# layer.

Describe the solution you'd like A way to find the RTT for every video and audio track for all active Peer Connections. Either more information in the GetStats function in PeerConnection.cs or maybe a second GetStats function in the VideoTrack/Transceiver objects.

Describe alternatives you've considered Get access to lower level WebRTC APIs and setup the C# layer myself, but not sure if I want to add a lot of custom code that should be there originally.

djee-ms commented 4 years ago

I guess this could be added to the per-track statistics. Do you know which stat you want exactly? Is it smoothedRoundTripTime? Looking at RTCTransportStats in M71 it doesn't look like it's implemented. @fibann any idea? Am I looking in the right place?

fibann commented 4 years ago

I think it's the one in RTCInboundRTPStreamStats (https://github.com/webrtc-uwp/webrtc/blob/baa89682df1ab891ae274a1cb2d9be3b1ee7e20b/api/stats/rtcstats_objects.h#L381) but it's not implemented in m71. In m80 there is a RTCRemoteInboundRtpStreamStats.round_trip_time which from a quick search in the code seems implemented (see ProduceRemoteInboundRtpStreamStatsFromReportBlockData in rtc_stats_collector.cc).

eirikhollis commented 4 years ago

As a start, any delay stat is better than none, but in my case the most interesting one would be the RTT of video frames. Or more specifically, the time it takes from video frame capture to the frame is displayed on the receiving side.