interceptor icon indicating copy to clipboard operation
interceptor copied to clipboard

The Jitter buffer iterceptor doesn't handle packet loss

Open braams opened this issue 8 months ago • 1 comments

Your environment.

  • Version: 72c0be86db35deb9b0a7361063314923a3d9a68c

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)
}

braams avatar Jun 05 '24 14:06 braams