pion / webrtc

Pure Go implementation of the WebRTC API
https://pion.ly
MIT License
13.37k stars 1.63k forks source link

rtp-forwarder corruption issue #2834

Closed xx396 closed 1 month ago

xx396 commented 1 month ago

Your environment.

Running the rtp-forwarder example that streams your webcam, and trying to receive with DISPLAY=:0 cvlc rtp-forwarder.sdp (though ffplay is the same) and while it starts okay, the image gradually becomes more corrupted as I move in front of it. After 3 seconds (which is the interrupt time), the whole screen goes corrupted. This corruption then changes noticeably every 3 seconds in line with that interrupt. This is if I happen to start the video player first, whereas it is just corrupted from the go if I start them the other way round.

If I change the code to use an ivfwriter as per the savetodisk example, everything works as expected. I can even set it writing for say a second before playing back the file and it continues to work fine just with that one second delay. Is this because it is more tolerant to packets arriving out of order etc or because the former similarly needs buffering time somehow?

Appreciate it's likely to be user error so any advice most welcome.

Sean-Der commented 1 month ago

Hi @xx396

Are you running the browser + raspberry pi in the same network?

One quick fix is you could pass intervalpli.GeneratorInterval(time.Millisecond * 200) as an argument here does that fix the corruption issue?

xx396 commented 1 month ago

Thanks for your response. Yes they are different devices on the LAN. As I say, I assume there isn't anything fundamentally wrong due to it streaming fine so long as it writes to an ivf, so I was going to see if that was possible using a named pipe instead. I will give that a try too but am not in a position to test for a week or so.

Sean-Der commented 1 month ago

Hey @xx396 I’m gonna close this for now since I don’t believe this is a Pion bug.

As we debug more and if anything comes up we can re-open and edit to fix bugs.

I’m also on https://pion.ly/slack to help debug