diff options
author | Benny Prijono <bennylp@teluu.com> | 2006-03-15 19:32:41 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2006-03-15 19:32:41 +0000 |
commit | b50cc8a5b479f2bece31381846bc5c63c5e8cdff (patch) | |
tree | fafd368e9eaa885ee96b4bab4bd1d95f62cfcf10 /pjsip | |
parent | 4bffa85a3577b72dab0141c44da5ca57914aec1f (diff) |
Added Null port, and changed conference so that it does not call port get_frame() when there is no listener on the port
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@318 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 4 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_core.c | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 1b58f9c1..5a39c9ed 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -64,7 +64,7 @@ PJ_BEGIN_DECL * Aditional ports to be allocated in the conference ports for non-call * streams. */ -#define PJSUA_CONF_MORE_PORTS 2 +#define PJSUA_CONF_MORE_PORTS 3 /** @@ -185,6 +185,8 @@ struct pjsua pj_bool_t no_mic; /**< Disable microphone. */ char *wav_file; /**< WAV file name to play. */ unsigned wav_slot; /**< WAV player slot in bridge */ + pjmedia_port *file_port; /**< WAV player port. */ + pjmedia_port *null_port; /**< NULL port. */ pj_bool_t auto_play; /**< Auto play file for calls? */ pj_bool_t auto_loop; /**< Auto loop RTP stream? */ pj_bool_t auto_conf; /**< Auto put to conference? */ diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index da2ab0f2..c8188fc9 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -753,15 +753,22 @@ static pj_status_t init_media(void) return status; } + /* Add NULL port to the bridge. */ + status = pjmedia_null_port_create( pjsua.pool, pjsua.clock_rate, + pjsua.clock_rate * 20 / 1000, 16, + &pjsua.null_port); + pjmedia_conf_add_port( pjsua.mconf, pjsua.pool, pjsua.null_port, + &pjsua.null_port->info.name, NULL ); + /* Create WAV file player if required: */ if (pjsua.wav_file) { - pjmedia_port *port; pj_str_t port_name; /* Create the file player port. */ status = pjmedia_file_player_port_create( pjsua.pool, pjsua.wav_file, - 0, -1, NULL, &port); + 0, -1, NULL, + &pjsua.file_port); if (status != PJ_SUCCESS) { pjsua_perror(THIS_FILE, "Error playing media file", @@ -770,7 +777,8 @@ static pj_status_t init_media(void) } /* Add port to conference bridge: */ - status = pjmedia_conf_add_port(pjsua.mconf, pjsua.pool, port, + status = pjmedia_conf_add_port(pjsua.mconf, pjsua.pool, + pjsua.file_port, pj_cstr(&port_name, pjsua.wav_file), &pjsua.wav_slot); if (status != PJ_SUCCESS) { @@ -1049,6 +1057,13 @@ pj_status_t pjsua_destroy(void) if (pjsua.mconf) pjmedia_conf_destroy(pjsua.mconf); + /* Destroy file port */ + pjmedia_port_destroy(pjsua.file_port); + + /* Destroy null port. */ + pjmedia_port_destroy(pjsua.null_port); + + /* Destroy sound framework: * (this should be done in pjmedia_shutdown()) */ |