Skip to content

Commit 8d5a561

Browse files
Signed-off-by: Pesala Silva <[email protected]>Bug_Fixes_and_optim… (#4585)
1 parent 7be99a9 commit 8d5a561

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

pjmedia/src/pjmedia/null_port.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ static pj_status_t null_get_frame(pjmedia_port *this_port,
9494
{
9595
frame->type = PJMEDIA_FRAME_TYPE_AUDIO;
9696
frame->size = PJMEDIA_PIA_AVG_FSZ(&this_port->info);
97+
#if PJ_HAS_INT64
98+
frame->timestamp.u64 += PJMEDIA_PIA_SPF(&this_port->info);
99+
#else
97100
frame->timestamp.u32.lo += PJMEDIA_PIA_SPF(&this_port->info);
101+
#endif
98102
pjmedia_zero_samples((pj_int16_t*)frame->buf,
99103
PJMEDIA_PIA_SPF(&this_port->info));
100104

pjmedia/src/pjmedia/silencedet.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ PJ_DEF(pj_bool_t) pjmedia_silence_det_detect( pjmedia_silence_det *sd,
327327
pj_int32_t *p_level)
328328
{
329329
pj_uint32_t level;
330+
331+
/* If VAD is disabled, return false */
332+
if (!p_level && (sd->mode == VAD_MODE_NONE))
333+
return PJ_FALSE;
330334

331335
/* Calculate average signal level. */
332336
level = pjmedia_calc_avg_signal(samples, count);

pjsip/include/pjsua-lib/pjsua_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ struct pjsua_data
580580
/* Calls: */
581581
pjsua_config ua_cfg; /**< UA config. */
582582
unsigned call_cnt; /**< Call counter. */
583-
pjsua_call calls[PJSUA_MAX_CALLS];/**< Calls array. */
583+
pjsua_call *calls; /**< Calls array. */
584584
pjsua_call_id next_call_id; /**< Next call id to use*/
585585

586586
/* Buddy; */

pjsip/src/pjsip/sip_transaction.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2651,6 +2651,8 @@ PJ_DEF(pj_status_t) pjsip_tsx_retransmit_no_state(pjsip_transaction *tsx,
26512651
{
26522652
pj_status_t status;
26532653

2654+
PJ_ASSERT_RETURN(tsx != NULL, PJ_EINVAL);
2655+
26542656
pj_grp_lock_acquire(tsx->grp_lock);
26552657
if (tdata == NULL) {
26562658
tdata = tsx->last_tx;
@@ -2665,7 +2667,7 @@ PJ_DEF(pj_status_t) pjsip_tsx_retransmit_no_state(pjsip_transaction *tsx,
26652667
if (status == PJ_SUCCESS) {
26662668
pjsip_tx_data_dec_ref(tdata);
26672669
}
2668-
2670+
26692671
return status;
26702672
}
26712673

pjsip/src/pjsip/sip_util.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,8 @@ static void stateless_send_transport_cb( void *token,
12551255

12561256
if (tdata->via_addr.host.slen > 0 &&
12571257
(!tdata->via_tp ||
1258-
tdata->via_tp == (void *)stateless_data->cur_transport))
1258+
tdata->via_tp == (void*)stateless_data->cur_transport ||
1259+
tdata->msg->line.req.method.id == PJSIP_CANCEL_METHOD))
12591260
{
12601261
via->sent_by = tdata->via_addr;
12611262

pjsip/src/pjsua-lib/pjsua_call.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,22 @@ pj_status_t pjsua_call_subsys_init(const pjsua_config *cfg)
209209
const pj_str_t str_trickle_ice = { "trickle-ice", 11 };
210210
pj_status_t status;
211211

212-
/* Init calls array. */
213-
for (i=0; i<PJ_ARRAY_SIZE(pjsua_var.calls); ++i)
214-
reset_call(i);
215-
216212
/* Copy config */
217213
pjsua_config_dup(pjsua_var.pool, &pjsua_var.ua_cfg, cfg);
218214

219215
/* Verify settings */
220-
if (pjsua_var.ua_cfg.max_calls >= PJSUA_MAX_CALLS) {
216+
if (pjsua_var.ua_cfg.max_calls > PJSUA_MAX_CALLS)
221217
pjsua_var.ua_cfg.max_calls = PJSUA_MAX_CALLS;
222-
}
218+
219+
pjsua_var.calls = (pjsua_call *)pj_pool_zalloc(pjsua_var.pool,
220+
sizeof(pjsua_call) *
221+
pjsua_var.ua_cfg.max_calls);
222+
if (!pjsua_var.calls)
223+
return PJ_ENOMEM;
224+
225+
/* Init calls array. */
226+
for (i = 0U; i < pjsua_var.ua_cfg.max_calls; ++i)
227+
reset_call(i);
223228

224229
/* Check the route URI's and force loose route if required */
225230
for (i=0; i<pjsua_var.ua_cfg.outbound_proxy_cnt; ++i) {
@@ -2942,8 +2947,8 @@ PJ_DEF(pj_status_t) pjsua_call_answer2(pjsua_call_id call_id,
29422947
msg_data);
29432948
}
29442949
pj_list_push_back(&call->async_call.call_var.inc_call.answers,
2945-
answer);
2946-
2950+
answer);
2951+
29472952
PJSUA_UNLOCK();
29482953
if (dlg) pjsip_dlg_dec_lock(dlg);
29492954
pj_log_pop_indent();

0 commit comments

Comments
 (0)