Fix coverity scan warnings
This commit is contained in:
parent
7615589583
commit
319bbab087
|
@ -1142,6 +1142,7 @@ static pj_status_t auth_respond_basic(pj_http_req *hreq)
|
|||
*/
|
||||
pj_str_t user_pass;
|
||||
pj_http_header_elmt *phdr;
|
||||
pj_status_t status;
|
||||
int len;
|
||||
|
||||
/* Use send buffer to store userid ":" password */
|
||||
|
@ -1164,8 +1165,10 @@ static pj_status_t auth_respond_basic(pj_http_req *hreq)
|
|||
|
||||
pj_strcpy2(&phdr->value, "Basic ");
|
||||
len -= (int)phdr->value.slen;
|
||||
pj_base64_encode((pj_uint8_t*)user_pass.ptr, (int)user_pass.slen,
|
||||
phdr->value.ptr + phdr->value.slen, &len);
|
||||
status = pj_base64_encode((pj_uint8_t*)user_pass.ptr, (int)user_pass.slen,
|
||||
phdr->value.ptr + phdr->value.slen, &len);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
phdr->value.slen += len;
|
||||
|
||||
return PJ_SUCCESS;
|
||||
|
|
|
@ -161,7 +161,13 @@ PJ_DEF(pj_status_t) pjmedia_aud_test( const pjmedia_aud_param *param,
|
|||
|
||||
test_data.pool = pj_pool_create(pjmedia_aud_subsys_get_pool_factory(),
|
||||
"audtest", 1000, 1000, NULL);
|
||||
pj_mutex_create_simple(test_data.pool, "sndtest", &test_data.mutex);
|
||||
status = pj_mutex_create_simple(test_data.pool, "sndtest",
|
||||
&test_data.mutex);
|
||||
if (status != PJ_SUCCESS) {
|
||||
app_perror("Error creating mutex", status);
|
||||
pj_pool_release(test_data.pool);
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open device.
|
||||
|
|
|
@ -274,6 +274,7 @@ PJ_DEF(pj_status_t) pjmedia_codec_speex_init( pjmedia_endpt *endpt,
|
|||
/* Get codec framesize and avg bitrate for each mode. */
|
||||
for (i=0; i<PJ_ARRAY_SIZE(spx_factory.speex_param); ++i) {
|
||||
status = get_speex_info(&spx_factory.speex_param[i]);
|
||||
PJ_ASSERT_ON_FAIL(status != PJ_SUCCESS, goto on_error);
|
||||
}
|
||||
|
||||
/* Get the codec manager. */
|
||||
|
|
|
@ -201,6 +201,8 @@ PJ_DEF(pj_status_t) pjmedia_sdp_media_cmp( const pjmedia_sdp_media *sd1,
|
|||
if (!sd2->conn)
|
||||
return PJMEDIA_SDP_EMEDIANOTEQUAL;
|
||||
status = compare_conn(sd1->conn, sd2->conn);
|
||||
if (status != PJ_SUCCESS)
|
||||
return status;
|
||||
} else {
|
||||
if (sd2->conn)
|
||||
return PJMEDIA_SDP_EMEDIANOTEQUAL;
|
||||
|
|
|
@ -113,7 +113,8 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_create_w_local_offer( pj_pool_t *pool,
|
|||
*p_neg = NULL;
|
||||
|
||||
/* Validate local offer. */
|
||||
PJ_ASSERT_RETURN((status=pjmedia_sdp_validate(local))==PJ_SUCCESS, status);
|
||||
status = pjmedia_sdp_validate(local);
|
||||
PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
|
||||
|
||||
/* Create and initialize negotiator. */
|
||||
neg = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_neg);
|
||||
|
@ -165,8 +166,8 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_create_w_remote_offer(pj_pool_t *pool,
|
|||
neg->neg_remote_sdp = pjmedia_sdp_session_clone(pool, remote);
|
||||
|
||||
if (initial) {
|
||||
PJ_ASSERT_RETURN((status=pjmedia_sdp_validate(initial))==PJ_SUCCESS,
|
||||
status);
|
||||
status = pjmedia_sdp_validate(initial);
|
||||
PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
|
||||
|
||||
neg->initial_sdp = pjmedia_sdp_session_clone(pool, initial);
|
||||
neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, initial);
|
||||
|
@ -1468,7 +1469,8 @@ static pj_status_t create_answer( pj_pool_t *pool,
|
|||
/* Validate remote offer.
|
||||
* This should have been validated before.
|
||||
*/
|
||||
PJ_ASSERT_RETURN((status=pjmedia_sdp_validate(offer))==PJ_SUCCESS, status);
|
||||
status = pjmedia_sdp_validate(offer);
|
||||
PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
|
||||
|
||||
/* Create initial answer by duplicating initial SDP,
|
||||
* but clear all media lines. The media lines will be filled up later.
|
||||
|
|
|
@ -789,7 +789,7 @@ static pj_status_t get_frame( pjmedia_port *port, pjmedia_frame *frame)
|
|||
PJ_LOG(5,(stream->port.info.name.ptr,
|
||||
"Jitter buffer starts returning normal frames "
|
||||
"(after %d empty/lost)",
|
||||
stream->jb_last_frm_cnt, stream->jb_last_frm));
|
||||
stream->jb_last_frm_cnt));
|
||||
|
||||
stream->jb_last_frm = frame_type;
|
||||
stream->jb_last_frm_cnt = 1;
|
||||
|
@ -894,7 +894,7 @@ static pj_status_t get_frame_ext( pjmedia_port *port, pjmedia_frame *frame)
|
|||
PJ_LOG(5,(stream->port.info.name.ptr,
|
||||
"Jitter buffer starts returning normal frames "
|
||||
"(after %d empty/lost)",
|
||||
stream->jb_last_frm_cnt, stream->jb_last_frm));
|
||||
stream->jb_last_frm_cnt));
|
||||
|
||||
stream->jb_last_frm = frame_type;
|
||||
stream->jb_last_frm_cnt = 1;
|
||||
|
@ -2979,7 +2979,9 @@ PJ_DEF(pj_status_t) pjmedia_stream_destroy( pjmedia_stream *stream )
|
|||
/* If we're in the middle of transmitting DTMF digit, send one last
|
||||
* RFC 2833 RTP packet with 'End' flag set.
|
||||
*/
|
||||
if (stream->tx_dtmf_count && stream->tx_dtmf_buf[0].duration != 0) {
|
||||
if (stream->tx_dtmf_count && stream->tx_dtmf_buf[0].duration != 0 &&
|
||||
stream->transport)
|
||||
{
|
||||
pjmedia_frame frame_out;
|
||||
pjmedia_channel *channel = stream->enc;
|
||||
int first=0, last=0;
|
||||
|
|
|
@ -545,6 +545,8 @@ PJ_DEF(pj_status_t) pjmedia_stream_info_from_sdp(
|
|||
if (rtcp.addr.slen) {
|
||||
status = pj_sockaddr_init(rem_af, &si->rem_rtcp, &rtcp.addr,
|
||||
(pj_uint16_t)rtcp.port);
|
||||
if (status != PJ_SUCCESS)
|
||||
return PJMEDIA_EINVALIDIP;
|
||||
} else {
|
||||
pj_sockaddr_init(rem_af, &si->rem_rtcp, NULL,
|
||||
(pj_uint16_t)rtcp.port);
|
||||
|
|
|
@ -187,14 +187,14 @@ pjmedia_transport_loop_create2(pjmedia_endpt *endpt,
|
|||
if (tp->setting.addr.slen) {
|
||||
pj_strdup(pool, &tp->setting.addr, &opt->addr);
|
||||
} else {
|
||||
pj_strset2(&tp->setting.addr, (opt->af == pj_AF_INET())?
|
||||
pj_strset2(&tp->setting.addr, (tp->setting.af == pj_AF_INET())?
|
||||
"127.0.0.1": "::1");
|
||||
}
|
||||
if (tp->setting.port == 0)
|
||||
tp->setting.port = 4000;
|
||||
|
||||
/* alloc users array */
|
||||
tp->max_attach_cnt = opt->max_attach_cnt;
|
||||
tp->max_attach_cnt = tp->setting.max_attach_cnt;
|
||||
if (tp->max_attach_cnt == 0)
|
||||
tp->max_attach_cnt = 1;
|
||||
tp->users = (struct tp_user *)pj_pool_calloc(pool, tp->max_attach_cnt, sizeof(struct tp_user));
|
||||
|
|
|
@ -850,7 +850,7 @@ static pj_bool_t turn_on_data_read(test_server *test_srv,
|
|||
|
||||
if (j==alloc->perm_cnt) {
|
||||
PJ_LOG(5,("", "SendIndication to %s is rejected (no permission)",
|
||||
peer_info, client_info, alloc->perm_cnt));
|
||||
peer_info));
|
||||
} else {
|
||||
PJ_LOG(5,(THIS_FILE, "Relaying %d bytes data from client %s to peer %s, "
|
||||
"perm_cnt=%d",
|
||||
|
|
|
@ -818,8 +818,9 @@ PJ_DEF(pj_status_t) pj_ice_sess_add_cand(pj_ice_sess *ice,
|
|||
pj_assert(i < PJ_ARRAY_SIZE(ice->tp_data) &&
|
||||
ice->tp_data[i].transport_id == transport_id);
|
||||
|
||||
pj_ansi_strcpy(ice->tmp.txt, pj_sockaddr_print(&lcand->addr, address,
|
||||
sizeof(address), 2));
|
||||
pj_ansi_strncpy(ice->tmp.txt, pj_sockaddr_print(&lcand->addr, address,
|
||||
sizeof(address), 2),
|
||||
sizeof(ice->tmp.txt));
|
||||
LOG4((ice->obj_name,
|
||||
"Candidate %d added: comp_id=%d, type=%s, foundation=%.*s, "
|
||||
"addr=%s:%d, base=%s:%d, prio=0x%x (%u)",
|
||||
|
|
|
@ -1572,8 +1572,6 @@ static pj_status_t setup_turn_perm( pj_ice_strans *ice_st)
|
|||
/* Gather remote addresses for this component */
|
||||
rem_cand_cnt = ice_st->ice->rcand_cnt;
|
||||
rem_cand = ice_st->ice->rcand;
|
||||
if (status != PJ_SUCCESS)
|
||||
continue;
|
||||
|
||||
for (j=0; j<rem_cand_cnt && count<PJ_ARRAY_SIZE(addrs); ++j) {
|
||||
if (rem_cand[j].comp_id==i+1 &&
|
||||
|
|
|
@ -316,6 +316,7 @@ static pj_status_t apply_msg_options(pj_stun_session *sess,
|
|||
status = pj_stun_msg_add_string_attr(pool, msg,
|
||||
PJ_STUN_ATTR_NONCE,
|
||||
&nonce);
|
||||
PJ_ASSERT_RETURN(status==PJ_SUCCESS, status);
|
||||
}
|
||||
|
||||
/* Add MESSAGE-INTEGRITY attribute */
|
||||
|
|
|
@ -738,7 +738,7 @@ PJ_DEF(pj_status_t) pj_turn_session_alloc(pj_turn_session *sess,
|
|||
PJ_ASSERT_RETURN(sess->state>PJ_TURN_STATE_NULL &&
|
||||
sess->state<=PJ_TURN_STATE_RESOLVED,
|
||||
PJ_EINVALIDOP);
|
||||
PJ_ASSERT_RETURN(param->peer_conn_type == PJ_TURN_TP_UDP ||
|
||||
PJ_ASSERT_RETURN(!param || param->peer_conn_type == PJ_TURN_TP_UDP ||
|
||||
param->peer_conn_type == PJ_TURN_TP_TCP,
|
||||
PJ_EINVAL);
|
||||
|
||||
|
|
|
@ -328,7 +328,7 @@ PJ_DEF(pj_status_t) pj_turn_sock_create(pj_stun_config *cfg,
|
|||
}
|
||||
|
||||
/* Session lock */
|
||||
if (setting && setting->grp_lock) {
|
||||
if (setting->grp_lock) {
|
||||
turn_sock->grp_lock = setting->grp_lock;
|
||||
} else {
|
||||
status = pj_grp_lock_create(pool, NULL, &turn_sock->grp_lock);
|
||||
|
@ -769,6 +769,11 @@ static pj_bool_t on_connect_complete(pj_turn_sock *turn_sock,
|
|||
status = pj_ssl_sock_start_read(turn_sock->ssl_sock, turn_sock->pool,
|
||||
turn_sock->setting.max_pkt_size, 0);
|
||||
#endif
|
||||
if (status != PJ_SUCCESS) {
|
||||
sess_fail(turn_sock, "Error in start_read", status);
|
||||
pj_grp_lock_release(turn_sock->grp_lock);
|
||||
return PJ_FALSE;
|
||||
}
|
||||
|
||||
/* Init send_key */
|
||||
pj_ioqueue_op_key_init(&turn_sock->send_key, sizeof(turn_sock->send_key));
|
||||
|
@ -1609,6 +1614,11 @@ static void turn_on_connection_attempt(pj_turn_session *sess,
|
|||
pj_status_t status;
|
||||
unsigned i;
|
||||
|
||||
if (turn_sock == NULL) {
|
||||
/* We've been destroyed */
|
||||
return;
|
||||
}
|
||||
|
||||
PJ_ASSERT_ON_FAIL(turn_sock->conn_type == PJ_TURN_TP_TCP &&
|
||||
turn_sock->alloc_param.peer_conn_type == PJ_TURN_TP_TCP,
|
||||
return);
|
||||
|
@ -1616,11 +1626,6 @@ static void turn_on_connection_attempt(pj_turn_session *sess,
|
|||
PJ_LOG(5,(turn_sock->pool->obj_name, "Connection attempt from peer %s",
|
||||
pj_sockaddr_print(peer_addr, addrtxt, sizeof(addrtxt), 3)));
|
||||
|
||||
if (turn_sock == NULL) {
|
||||
/* We've been destroyed */
|
||||
return;
|
||||
}
|
||||
|
||||
pj_grp_lock_acquire(turn_sock->grp_lock);
|
||||
|
||||
if (turn_sock->data_conn_cnt == PJ_TURN_MAX_TCP_CONN_CNT) {
|
||||
|
|
|
@ -341,7 +341,9 @@ public:
|
|||
*/
|
||||
AccountCallConfig() : holdType(PJSUA_CALL_HOLD_TYPE_DEFAULT),
|
||||
prackUse(PJSUA_100REL_NOT_USED),
|
||||
timerUse(PJSUA_SIP_TIMER_OPTIONAL)
|
||||
timerUse(PJSUA_SIP_TIMER_OPTIONAL),
|
||||
timerMinSESec(90),
|
||||
timerSessExpiresSec(PJSIP_SESS_TIMER_DEF_SE)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
@ -748,7 +750,9 @@ public:
|
|||
iceWaitNominationTimeoutMsec(ICE_CONTROLLED_AGENT_WAIT_NOMINATION_TIMEOUT),
|
||||
iceNoRtcp(false),
|
||||
iceAlwaysUpdate(true),
|
||||
turnEnabled(false),
|
||||
turnConnType(PJ_TURN_TP_UDP),
|
||||
turnPasswordType(0),
|
||||
contactRewriteUse(PJ_TRUE),
|
||||
contactRewriteMethod(PJSUA_CONTACT_REWRITE_METHOD),
|
||||
contactUseSrcPort(PJ_TRUE),
|
||||
|
@ -1035,6 +1039,7 @@ struct AccountMediaConfig : public PersistentObject
|
|||
|
||||
/**
|
||||
* Enable RTP and RTCP multiplexing.
|
||||
* Default: false
|
||||
*/
|
||||
bool rtcpMuxEnabled;
|
||||
|
||||
|
@ -1072,8 +1077,16 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
AccountMediaConfig() : srtpUse(PJSUA_DEFAULT_USE_SRTP),
|
||||
ipv6Use(PJSUA_IPV6_DISABLED)
|
||||
AccountMediaConfig()
|
||||
: lockCodecEnabled(true),
|
||||
streamKaEnabled(false),
|
||||
srtpUse(PJSUA_DEFAULT_USE_SRTP),
|
||||
srtpSecureSignaling(PJSUA_DEFAULT_SRTP_SECURE_SIGNALING),
|
||||
ipv6Use(PJSUA_IPV6_DISABLED),
|
||||
rtcpMuxEnabled(false),
|
||||
rtcpXrEnabled(PJMEDIA_STREAM_ENABLE_XR),
|
||||
useLoopMedTp(false),
|
||||
enableLoopback(false)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
@ -1185,8 +1198,16 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
AccountVideoConfig() :
|
||||
rateControlMethod(PJMEDIA_VID_STREAM_RC_SIMPLE_BLOCKING)
|
||||
AccountVideoConfig()
|
||||
: autoShowIncoming(false),
|
||||
autoTransmitOutgoing(false),
|
||||
windowFlags(0),
|
||||
defaultCaptureDevice(PJMEDIA_VID_DEFAULT_CAPTURE_DEV),
|
||||
defaultRenderDevice(PJMEDIA_VID_DEFAULT_RENDER_DEV),
|
||||
rateControlMethod(PJMEDIA_VID_STREAM_RC_SIMPLE_BLOCKING),
|
||||
rateControlBandwidth(0),
|
||||
startKeyframeCount(PJMEDIA_VID_STREAM_START_KEYFRAME_CNT),
|
||||
startKeyframeInterval(PJMEDIA_VID_STREAM_START_KEYFRAME_INTERVAL_MSEC)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
@ -1445,7 +1466,14 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
AccountInfo() : regStatus(PJSIP_SC_NULL)
|
||||
AccountInfo() : id(PJSUA_INVALID_ID),
|
||||
isDefault(false),
|
||||
regIsConfigured(false),
|
||||
regIsActive(false),
|
||||
regExpiresSec(0),
|
||||
regStatus(PJSIP_SC_NULL),
|
||||
regLastErr(-1),
|
||||
onlineStatus(false)
|
||||
{}
|
||||
|
||||
/** Import from pjsip data */
|
||||
|
|
|
@ -546,8 +546,12 @@ public:
|
|||
*/
|
||||
CallInfo() : id(PJSUA_INVALID_ID),
|
||||
role(PJSIP_ROLE_UAC),
|
||||
accId(PJSUA_INVALID_ID),
|
||||
state(PJSIP_INV_STATE_NULL),
|
||||
lastStatusCode(PJSIP_SC_NULL)
|
||||
lastStatusCode(PJSIP_SC_NULL),
|
||||
remOfferer(false),
|
||||
remAudioCount(0),
|
||||
remVideoCount(0)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
@ -658,9 +662,22 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
StreamInfo() : type(PJMEDIA_TYPE_NONE),
|
||||
proto(PJMEDIA_TP_PROTO_NONE),
|
||||
dir(PJMEDIA_DIR_NONE)
|
||||
StreamInfo()
|
||||
: type(PJMEDIA_TYPE_NONE),
|
||||
proto(PJMEDIA_TP_PROTO_NONE),
|
||||
dir(PJMEDIA_DIR_NONE),
|
||||
txPt(0),
|
||||
rxPt(0),
|
||||
codecClockRate(0),
|
||||
jbInit(-1),
|
||||
jbMinPre(-1),
|
||||
jbMaxPre(-1),
|
||||
jbMax(-1),
|
||||
jbDiscardAlgo(PJMEDIA_JB_DISCARD_NONE),
|
||||
#if defined(PJMEDIA_STREAM_ENABLE_KA) && PJMEDIA_STREAM_ENABLE_KA!=0
|
||||
useKa(false),
|
||||
#endif
|
||||
rtcpSdesByeDisabled(false)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
|
|
@ -456,7 +456,11 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
AudioMediaPlayerInfo() : formatId(PJMEDIA_FORMAT_L16)
|
||||
AudioMediaPlayerInfo()
|
||||
: formatId(PJMEDIA_FORMAT_L16),
|
||||
payloadBitsPerSample(0),
|
||||
sizeBytes(0),
|
||||
sizeSamples(0)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -2056,7 +2060,7 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
VideoDevInfo() : id(-1), dir(PJMEDIA_DIR_NONE)
|
||||
VideoDevInfo() : id(-1), dir(PJMEDIA_DIR_NONE), caps(0)
|
||||
{}
|
||||
|
||||
/**
|
||||
|
@ -2441,7 +2445,17 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
CodecParamInfo() : fmtId(PJMEDIA_FORMAT_L16)
|
||||
CodecParamInfo()
|
||||
: clockRate(0),
|
||||
channelCnt(0),
|
||||
avgBps(0),
|
||||
maxBps(0),
|
||||
maxRxFrameSize(0),
|
||||
frameLen(0),
|
||||
encFrameLen(0),
|
||||
pcmBitsPerSample(0),
|
||||
pt(0),
|
||||
fmtId(PJMEDIA_FORMAT_L16)
|
||||
{}
|
||||
};
|
||||
|
||||
|
@ -2533,7 +2547,9 @@ public:
|
|||
* Default constructor
|
||||
*/
|
||||
VidCodecParam() : dir(PJMEDIA_DIR_NONE),
|
||||
packing(PJMEDIA_VID_PACKING_UNKNOWN)
|
||||
packing(PJMEDIA_VID_PACKING_UNKNOWN),
|
||||
encMtu(0),
|
||||
ignoreFmtp(false)
|
||||
{}
|
||||
|
||||
void fromPj(const pjmedia_vid_codec_param ¶m);
|
||||
|
|
|
@ -172,8 +172,10 @@ public:
|
|||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
BuddyInfo() : subState(PJSIP_EVSUB_STATE_UNKNOWN),
|
||||
subTermCode(PJSIP_SC_NULL)
|
||||
BuddyInfo()
|
||||
: presMonitorEnabled(true),
|
||||
subState(PJSIP_EVSUB_STATE_UNKNOWN),
|
||||
subTermCode(PJSIP_SC_NULL)
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
@ -252,6 +252,9 @@ struct TimeVal
|
|||
long msec;
|
||||
|
||||
public:
|
||||
TimeVal() : sec(0), msec(0)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Convert from pjsip
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue