rtpjitterbuffer: rtx-next-seqnum=true causes packets discarded although they arrive in time
The sequence of events is as follows
- packet 1 arrives, expected timer for packet 2 is scheduled based on some packet rate estimate
- expected timer triggers and goes into the "reschedule as LOST timer" case, effectively updating
next_in_seqnum
- packet 2 arrives in time (maybe the sender shortly stopped capturing, skipped a frame before its encoder, or ...) but is discarded because
next_in_seqnum
was already updated
This might've been introduced by 63c7a9ae but I can't really test that because the change is entangled with lots of other changes, and my application won't work with a jitterbuffer before that version because it requires newer features.
The commit itself looks correct to me though, however I think there somewhere needs to be a distinction between RTX timers based on estimations and RTX timers that are set when a packet with a higher seqnum is arriving (and we actually know that the missing packet should've arrived by now).
Converting expected timers to lost timers before seeing a higher seqnum is wrong in any case.
Independent of that we should probably consider changing the default for rtx-next-seqnum
to false
as the code is quite dubious, and Pexip for example disable it because it causes more problems than it solves.
CC @hgr @ndufresne