-
Notifications
You must be signed in to change notification settings - Fork 806
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
Lock free audio #4230
Lock free audio #4230
Conversation
- some changes in sln to build with v143 build tools (VS 2022) - 2 new pjsystest project configuration to build as Debug-Dynamic and Release-Dynamic - stack implementation and testing incorporated into pjlib and pjlib-test projects
decreased the repeat counter increased the number of threads
# Conflicts: # pjlib/build/pjlib.vcxproj.filters
1) lock free (as much as possible) create/destroy file players/recorders 2) eliminate unnecessary lock in pjsua_conf_connect2() for typical server side usage (master port, bridge conf, no sound device) 3) immediately destroy temporary pools used to create file players/recorders. 4) Introduced PJSUA_MASTER_PORT_OPTIONS macro to set pjmedia_master_port_create() options parameter
Hi Leonid, thanks again for your patch. I agree that the global locking in pjsua-lib is really coarse, and you've shown an example where it could be improved (i.e in file player/recorder area). The intended usage of players is to pre-create them during app initialization, to minimize io bottleneck as you said. And I'd like to remind you that pjsua-lib was never intended to be used as high performance server side app. But still, if you like to force using it as IVR, and if you cannot pre-create the players during startup, the intended usage is to manage the media players/recorders yourself and register the media port with But still, again, if you like to have more fine grained lock granularity in file players/recorders, I would think that it would be much simpler if we just add mutex for it. I'm sure the improvement of lock free mutex will be very very small compared to the whole player creation time (which, if this is considered a problem, pjsua-lib already gives a way to let application manage it itself). |
Hi Benny! First of all thank you for explanation! I agree this is the best for my use case.
You are absolutely right, but I would like to point out: the advantage is not in locking free itself. The advantage is in the ability to create and initialize resources in parallel (in this example, different players/recorders can be created in parallel). This idea is even more useful in conference bridge, where it allows creating, initializing and registering conf ports in parallel. And thank you again for the offer to change lock granularity. It's not necessary, but I would really appreciate an implementation of the ability to get memory with explicit alignment, something like void *pj_pool_alligned_alloc( pool, allignment, size) (like C11 void *aligned_alloc(size_t alignment, size_t size);) |
For now we'll leave this in the application (see my prior comment).
Yes! I was thinking exactly the same thing. Feel free to submit a PR. |
Closing this for now since #4116 was not accepted. |
PS only 3 files are changed here:
Additional changes are inherited from stack implementation and tests #4116.