Description
Digging into how/why reading RTCP results in the data stream being corrupt.
I've
- Confirmed that in Pion, the code that I am trying to write works
- Isolated the issue to a simple repro
- Got suspicions that the issue is caused by a shared lock between RTP and RTCP, meaning the RTP only gets read when an RTCP packet comes in.
I'll dig deeper, and amend this issue as I do.
Discussed in #150
Originally posted by robashton January 13, 2022
As mentioned over on the Interceptor repo, webrtc-rs/interceptor#2 and indeed the subsequent pull request webrtc-rs/interceptor#3, I'm wanting to get hold of the RTCP (Specifically, the sender reports) being sent by the web browser so I can do some A/V sync downstream of the rust.
The documentation for Pion suggests that we should use the receiver passed to us in OnTrack to perform this function, as this will run any interceptors and give you the final RTCP. (Hence how I discovered the issues there). ( https://github.com/pion/webrtc/blob/master/examples/rtcp-processing/main.go#L31 )
Indeed, on ingest - without the call to read_rtcp, those interceptors never get executed and presumably the rtcp being sent to us is just dropped on the floor (as far as I can tell). If I call read_rtcp, it breaks the actual rtp somehow, even if I do nothing with the results.
Sticking in the following code to the on_track code in the save-to-disk example means the interceptors get ran and I get some RTCP (including the sender reports in that println), but means the data stream breaks.
tokio::spawn(async move {
loop{
tokio::select! {
result = receiver.read_rtcp() => {
println!("RTCP {:?}". result);
}
}
}
});
wnat am I missing? How are we supposed to make sure the interceptors get executed on ingest and things like sender reports are made available to us?