Skip to content
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

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open

Conversation

LeonidGoltsblat
Copy link
Contributor

@LeonidGoltsblat LeonidGoltsblat commented Dec 23, 2024

  1. The main idea of ​​this PR is to create file players/recorders without locking. These operations take a lot of time because they call file io under a global lock and thus interfere with the processing of other calls. This type of load is especially typical for IVR-type applications. To avoid blocking, a slot reservation algorithm based on the new pj_stack data structure (see stack implementation and tests #4116) is used, which eliminates the need for PJSUA_LOCK() based lock protection on the pjsua_var.player[], pjsua_var.recorder[] arrays.
  2. Fixed unnecessary locking in pjsua_conf_connect2() for typical server-side use (master port, conference bridge, no sound device). In this case, pjsua_conf_connect2() called PJSUA_LOCK() (waiting for others to unlock it and preventing other calls from being processed) but nothing happens within that lock.
  3. Memory usage optimization: Immediately destroy temporary pools used to create file players/recorders. Currently, these pools are only used in the legacy conference switch, not in the conference bridge.
  4. Introduced PJSUA_MASTER_PORT_OPTIONS macro to set pjmedia_master_port_create() options parameter. Before this PR we had the parameter but no way to set its value.

PS only 3 files are changed here:

LeonidGoltsblat and others added 30 commits October 26, 2024 00:16
- 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant