-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jbuf frame completeness #963
Conversation
6b484d8
to
08ab8f9
Compare
The plots will heavily depend on this PR. So currently I am not sure if we can/should separate it. |
We should have at least a before and after comparison. We can simply use this one for main: f63865f |
okay. Do you want to create the PR for your branch? Edit: I could create both PR re/baresip for the plots. |
Should we enable |
08ab8f9
to
9c3d5e6
Compare
Rebased, but it won't build so far. The plot data needs to be updated. I guess that github actions does not build the plot code. |
ea40cf9
to
c9eb069
Compare
the builds are failing because of this test line: test jbuf: TEST_ERR: /home/runner/work/re/re/test/jbuf.c:56: (No such file or directory [2])
I think we should leave these are only for manual debug test builds and should not be needed (like modules not build with higher debug info). |
This commit af375ad is to discuss trace module. It supports only one trace. If jbuf is enabled for audio + video, then the trace fails and we get mem leaks. This commit is minimal change to fix this. Better would be to extend trace module to support multiple traces. This could be used to generate
|
I think trace should handled different. There should only one single |
A frame is a sequence of RTP packets with equal timestamp. Now `jbuf_get()` does not pass packets before the oldest frame is complete.
f4b8069
to
a15575e
Compare
Looks like max frames is very quickly decreased/consumed by decoder after this. This should be smoothed I think, since it causes:
|
Currently we have
A We should also think about the audio pipeline. There are |
src/jbuf/jbuf.c
Outdated
|
||
if (!down && tmr_isrunning(&jb->tmr)) | ||
tmr_cancel(&jb->tmr); | ||
tmr_start(&jb->tmr, 250, reset_wait, jb); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this fixed 250ms
value works well with different fps
and min/max
jbuf combinations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure. Anyway, while analyzing audio streams with jitter simulation I saw that we need the computation of moving average rdiff
to reliable decide if the buffer may be reduced again and how much it can be reduced.
I'll replace the last two commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rdiff
didn't solve problem for audio. It was only 2 packets while number of complete frames need to be higher to avoid underruns in following aubuf.
Alternative: Beside the overall frame
Next try: Periodically, e.g. every second the number of complete frames |
Of course yesterday tried already without the line here removed 9a6c8c5 . But I had bad results because had both jbuf active (for audio and video) and thus the data was mixed which confused me. |
Analysing results for audio stream
|
* | ||
* @return number of frames | ||
*/ | ||
uint32_t jbuf_frames(const struct jbuf *jb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this dropped? It's useful for unit testing and this ensures frame counting works correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I'll add it.
Here #963 (comment) is an open question (1.) about "lost packets". Edit: I set this PR to "ready for review" and fix the unit tests. |
Should we move jbuf to baresip like @alfredh suggests? Again was thinking about the current solution in this PR. The result of Also I'll try with our fixed |
Compared with this results: #963 (comment)
This are less underruns. |
I will prepare some pcap based tests with SIPp (maybe within a extra tools repository), so it's easier to reproduce, see improvement and we can add real jitter examples (like WiFi/LTE). With
Unsure, will think about this, is this real packet lost or because of late lost? We should keep delay as small as possible (based on network condition).
Yes it would make testing easier for now. |
Great ideas for testing!
This makes no difference. The question is if it makes sense not to jump to Okay, then I prepare a PR for moving jbuf from re to baresip. This could be merged with low risk to current release. |
c599c9a
to
09383fc
Compare
move jbuf to baresip: |
Applied the changes to a baresip branch based on baresip#2743 |
jbuf: replace adaptive mode by frame completeness check
min
/max
specifies number of frames to keep in bufferjbuf_get()
does not deliver un-complete frames or out-of-order packets as long asmax
is not reachedjbuf_put()
keeps track of the complete sequence of packets (see fieldend
)end
always points to the end of the complete packet sequence. Thus between the head andend
no packet is missing.The implementation works for audio and video.
Keeping track of
end
, the number of framesnf
and the number of complete framesncf
does not increase theO(.)
-complexity ofjbuf_put()
orjbuf_get()
.TODOs: