pion / interceptor

Pluggable RTP/RTCP processors for building real time communication
https://pion.ly/
MIT License
104 stars 51 forks source link

The Jitter buffer iterceptor doesn't handle packet loss #256

Open braams opened 4 weeks ago

braams commented 4 weeks ago

Your environment.

What did you do?

I'm trying to use jitter buffer interceptor.

What did you expect?

I expect to get an error on read if the current packet was lost. And I expect to get the next packet on the next read.

What happened?

If even one packet was lost, all subsequent reads will return an error.

The reason

The interceptor does not handle the situation with the absence of the next packet and does not shift the expected packet number https://github.com/pion/interceptor/blob/142f17f90b527434b62ce2fd92676e6e262cd807/pkg/jitterbuffer/receiver_interceptor.go#L73 It looks like we should add something like this:

if errors.Is(err, ErrNotFound) {
    i.buffer.SetPlayoutHead(i.buffer.PlayoutHead() + 1)
}