summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2014-01-16 05:30:46 +0000
committerLiong Sauw Ming <ming@teluu.com>2014-01-16 05:30:46 +0000
commite56ea14ab8531ee3cec375460577d1b89bf62e26 (patch)
treedf77c3acb961514b2022ee9e030071b691145920 /pjsip/src/pjsua-lib
parentbd1c47e995a3a844868f1d4dcc8f77f163ae721b (diff)
Closed #1723: Merging pjsua2 branch into trunk
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4704 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_aud.c3
-rw-r--r--pjsip/src/pjsua-lib/pjsua_core.c60
2 files changed, 48 insertions, 15 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_aud.c b/pjsip/src/pjsua-lib/pjsua_aud.c
index e15c54aa..0f5172e9 100644
--- a/pjsip/src/pjsua-lib/pjsua_aud.c
+++ b/pjsip/src/pjsua-lib/pjsua_aud.c
@@ -741,10 +741,13 @@ PJ_DEF(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id id,
pj_bzero(info, sizeof(*info));
info->slot_id = id;
info->name = cinfo.name;
+ pjmedia_format_copy(&info->format, &cinfo.format);
info->clock_rate = cinfo.clock_rate;
info->channel_count = cinfo.channel_count;
info->samples_per_frame = cinfo.samples_per_frame;
info->bits_per_sample = cinfo.bits_per_sample;
+ info->tx_level_adj = ((float)cinfo.tx_adj_level) / 128 + 1;
+ info->rx_level_adj = ((float)cinfo.rx_adj_level) / 128 + 1;
/* Build array of listeners */
info->listener_cnt = cinfo.listener_cnt;
diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c
index 8b0f0e62..e4893401 100644
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -699,6 +699,50 @@ static int worker_thread(void *arg)
return 0;
}
+PJ_DEF(pj_status_t) pjsua_register_worker_thread(const char *name)
+{
+ pj_thread_desc desc;
+ pj_thread_t *thread;
+ pj_status_t status;
+
+ if (pjsua_var.thread_quit_flag)
+ return PJ_EGONE;
+
+ status = pj_thread_register(NULL, desc, &thread);
+ if (status != PJ_SUCCESS)
+ return status;
+
+ if (name)
+ PJ_LOG(4,(THIS_FILE, "Worker thread %s started", name));
+
+ worker_thread(NULL);
+
+ if (name)
+ PJ_LOG(4,(THIS_FILE, "Worker thread %s stopped", name));
+
+ return PJ_SUCCESS;
+}
+
+PJ_DEF(void) pjsua_stop_worker_threads(void)
+{
+ unsigned i;
+
+ pjsua_var.thread_quit_flag = 1;
+
+ /* Wait worker threads to quit: */
+ for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) {
+ if (pjsua_var.thread[i]) {
+ pj_status_t status;
+ status = pj_thread_join(pjsua_var.thread[i]);
+ if (status != PJ_SUCCESS) {
+ PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread"));
+ pj_thread_sleep(1000);
+ }
+ pj_thread_destroy(pjsua_var.thread[i]);
+ pjsua_var.thread[i] = NULL;
+ }
+ }
+}
/* Init random seed */
static void init_random_seed(void)
@@ -1478,21 +1522,7 @@ PJ_DEF(pj_status_t) pjsua_destroy2(unsigned flags)
}
/* Signal threads to quit: */
- pjsua_var.thread_quit_flag = 1;
-
- /* Wait worker threads to quit: */
- for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) {
- if (pjsua_var.thread[i]) {
- pj_status_t status;
- status = pj_thread_join(pjsua_var.thread[i]);
- if (status != PJ_SUCCESS) {
- PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread"));
- pj_thread_sleep(1000);
- }
- pj_thread_destroy(pjsua_var.thread[i]);
- pjsua_var.thread[i] = NULL;
- }
- }
+ pjsua_stop_worker_threads();
if (pjsua_var.endpt) {
unsigned max_wait;