-
Notifications
You must be signed in to change notification settings - Fork 430
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
misc: rx thread activate #2828
misc: rx thread activate #2828
Conversation
When everything is green the commit ee740e3 will be reverted. |
This can be tested by enabling the RX thread with this line in your
@juha-h Please could you test this with the Android App? @larsimmisch Please could you test this with the vad filter? You will notice the line
in stdout of the baresip process. |
I saw a problem on On Any hints what to look for? Creating a minimal test application would obviously be good, but I wouldn't get to it before the weekend. |
Ah, it can be reproduced through the debug interface. Something like:
Then place an incoming call, accept it and:
My config has:
|
@cspiel1 I tried the PR in my Android app and receiving audio worked OK. I saw these in the log:
|
Thanks @juha-h for the test. The log is exactly what I would expect. @larsimmisch I understood that this problem is in |
@larsimmisch The issue you found has nothing to do with |
Thanks for the speedy fix on I've now tested this branch (with the fix cherry-picked) with the config The test was fine. |
Thanks for the test! |
src/aureceiver.c
Outdated
@@ -722,16 +746,19 @@ int aurecv_debug(struct re_printf *pf, const struct audio_recv *ar) | |||
err |= mbuf_printf(mb, " time = (not started)\n"); | |||
} | |||
|
|||
err |= re_hprintf(pf, " player: %s,%s %s\n", | |||
err |= mbuf_printf(mb, " player: %s,%s %s\n", |
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.
this looks like a separate bugfix ? perhaps a separate PR for this ?
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.
src/config.c
Outdated
cfg->avt.rxmode = RECEIVE_MODE_THREAD; | ||
warning("rtp_rxmode thread is currently " | ||
"experimental\n"); | ||
} |
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.
please compare all values, and print a warning if it matches none
src/config.c
Outdated
@@ -633,6 +644,8 @@ int config_print(struct re_printf *pf, const struct config *cfg) | |||
cfg->avt.rtp_stats ? "yes" : "no", | |||
cfg->avt.rtp_timeout, | |||
cfg->avt.bundle ? "yes" : "no", | |||
cfg->avt.rxmode == RECEIVE_MODE_THREAD ? "thread" : | |||
"main", |
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.
What if someone adds a new mode called e.g. "foo" ?
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.
I added rtp_receive_mode_str()
.
test/call.c
Outdated
@@ -853,11 +853,12 @@ static void event_handler(struct ua *ua, enum ua_event ev, | |||
} | |||
|
|||
|
|||
int test_call_answer(void) | |||
static int test_call_answer_base(enum rtp_receive_mode rxmode) |
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.
adding the explicit rxmode is a good solution.
please note that it should also be possible to add new arguments to the selftest binary,
that can set the rxmode. This will make it possible to run the test with these options:
$ ./selftest -r main
$ ./selftest -r thread
I have not seen a rational for rx thread. What are its advantages/disadvantages? In which situations it should he activated? Why is it not the default mode? |
We had this discussion earlyer in this year. To sum it up: Audio processing should be done in an independent thread. The main thread handles everything from SIP signaling, parts of video processing and also processing of arbitrary baresip modules. In the meanwhile we already have test results that show that the RX thread reduces the maximum deviation from the packet time that is caused by long blocking calls at the beginning of a call. For our products we already switched to For now edit: |
5851e48
to
1121860
Compare
Resolved the conflicts right now. still TODO:
|
TODO:
|
@cspiel1 Thanks for the explanation. |
Now In |
It is a mystery to me why this didn't appear earlier. The output of sanitizer is:
@sreimers solutions that I can think of
(A) most likely would produce new concurrency problems that would have to be solved. edit: Just realized that this should not occur, because the write to the edit 2: Last edit was not correct. The RTCP call back handler in baresip passes RTCP work to the main thread. But in |
Most of the RTCP work in
|
Last commit implements solution (A). TODO:
Edit: Done with this PR in re: baresip/re#1037 |
bc82df7
to
a16aff0
Compare
Rebased and dropped the reverted changes in The following commit will add delayed calls to |
26136d6
to
a5f8af4
Compare
Fixes the sanitizer warning "unlock of an unlocked mutex"
This reverts commit ee740e3.
adds command arguments for selecting rx mode
This solves concurrency failures with RX thread for RTCP.
a5f8af4
to
e42bf7d
Compare
|
When waiting on multiple different events with valgrind it showed that 2ms timers lead to a faster test finish than 1ms timers.
e42bf7d
to
a17e198
Compare
it should be ok to merge this now.. |
Thank you for your support, reviews and interest on this work! |
The last part for the audio RX "real-time" thread.
Enables RX thread via config, uses worker for passing work to the main thread and adds tests to ensure thread safety.