baresip
baresip copied to clipboard
jbuf frame completeness
This PR improves jbuf in order to
- ensure frame completeness for video and correct order of frames,
- reduce the buffered frames with return EAGAIN if it is possible, but not too early.
- Correct order of frames/packets for audio streams.
- Does not increase
O-notation complexity forjbuf_put()norjbuf_get(). - Makes adaptive mode obsolete and removes it.
This PR still is a draft and will be compared to https://github.com/baresip/baresip/pull/2757.
PR description reads:
config: remove jbuf mode adaptive
but docs/examples/config still has it for audio and video.
Have I misunderstood something?
Plots for video
- without packet loss
- with packet loss
Plots for audio
The second plot of each set is the ajb plot of the adaptive audio buffer. See https://github.com/baresip/re/blob/main/rem/aubuf/ajb.c !
Underruns in jbuf lead to underruns in the aubuf. Sometimes this can't be avoided, e.g. if there is a packet lost.
- min size 1 without packet loss
- min size 1 with packet loss
- min size 0 without packet loss
- min size 0 with packet loss
Looks like for audio, the buffers does not play well together, if I see correctly we have 2-3 packets in jbuf (20-60ms) + up to 80ms within aubuf and this does not compensate a 50ms jitter without packet loss (leads to real aubuf underruns)?
Looking at the ajb plots auf aubuf it looks like that the computed jitter does not increase fast enough to the expected value of 50ms. Ideally we would expect that there only underruns at the beginning of the simulated jitter. For these plots I used this jitter simulation:
sudo tc qdisc add dev ifb1 root netem delay 0ms 50ms loss 0.7%
Note that ajb is only active if configured with audio_buffer_mode adaptive.
This PR should touch only jbuf and
- ensure frame completeness for video and correct order of frames.
- Reduce the buffered frames with
return EAGAINif it is possible, but not too early.
The jbuf plots show that underruns because of out-of-order packets occur only at the start of the jitter. Additionally if there is a real packet loss. This is all we could expect from jbuf how it is used currently.
After this we could think about moving ajb from aubuf to jbuf and use a timer for jbuf_get() and the decoding.
please resolve the conflicts ...
I will resolve the conflicts tomorrow. @sreimers and me plan to compare this with: https://github.com/baresip/baresip/pull/2757
please update the description with more details.
Can you please also rebase this on top of git HEAD ?