Skip to content

Commit

Permalink
Move the setting to config.h
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming committed Jan 16, 2025
1 parent ef9a3ed commit ed2258f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
9 changes: 9 additions & 0 deletions pjmedia/include/pjmedia-audiodev/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ PJ_BEGIN_DECL
* @{
*/

/**
* This setting controls the maximum number of supported audio devices.
*
* Default: 64
*/
#ifndef PJMEDIA_AUD_DEV_MAX_DEVS
# define PJMEDIA_AUD_DEV_MAX_DEVS 64
#endif

/**
* This setting controls the buffer length of audio device name.
*
Expand Down
3 changes: 1 addition & 2 deletions pjmedia/include/pjmedia/audiodev.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ typedef pj_int32_t pjmedia_aud_dev_index;
#define PJMEDIA_AUD_INVALID_DEV -3

#define PJMEDIA_AUD_MAX_DRIVERS 16
#define PJMEDIA_AUD_MAX_DEVS 64


/** Forward declaration for pjmedia_aud_stream */
Expand Down Expand Up @@ -117,7 +116,7 @@ typedef struct pjmedia_aud_subsys
pjmedia_aud_driver drv[PJMEDIA_AUD_MAX_DRIVERS];/* Array of drivers. */

unsigned dev_cnt; /* Total number of devices. */
pj_uint32_t dev_list[PJMEDIA_AUD_MAX_DEVS];/* Array of dev IDs. */
pj_uint32_t dev_list[PJMEDIA_AUD_DEV_MAX_DEVS];/* Array dev IDs.*/

} pjmedia_aud_subsys;

Expand Down
2 changes: 1 addition & 1 deletion pjmedia/src/pjmedia-audiodev/alsa_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#define ALSASOUND_CAPTURE 2
#define MAX_SOUND_CARDS 5
#define MAX_SOUND_DEVICES_PER_CARD 5
#define MAX_DEVICES PJMEDIA_AUD_MAX_DEVS
#define MAX_DEVICES PJMEDIA_AUD_DEV_MAX_DEVS
#define MAX_MIX_NAME_LEN 64

/* Set to 1 to enable tracing */
Expand Down
6 changes: 3 additions & 3 deletions pjmedia/src/pjmedia/audiodev.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ PJ_DEF(pj_status_t) pjmedia_aud_driver_init(unsigned drv_idx,

/* Get number of devices */
dev_cnt = f->op->get_dev_count(f);
if (dev_cnt + aud_subsys.dev_cnt > PJMEDIA_AUD_MAX_DEVS) {
if (dev_cnt + aud_subsys.dev_cnt > PJMEDIA_AUD_DEV_MAX_DEVS) {
PJ_LOG(4,(THIS_FILE, "%d device(s) cannot be registered because"
" there are too many devices",
aud_subsys.dev_cnt + dev_cnt -
PJMEDIA_AUD_MAX_DEVS));
dev_cnt = PJMEDIA_AUD_MAX_DEVS - aud_subsys.dev_cnt;
PJMEDIA_AUD_DEV_MAX_DEVS));
dev_cnt = PJMEDIA_AUD_DEV_MAX_DEVS - aud_subsys.dev_cnt;
}

/* enabling this will cause pjsua-lib initialization to fail when there
Expand Down

0 comments on commit ed2258f

Please sign in to comment.