Commit b9f9dc1c authored by Ronan's avatar Ronan
Browse files

fix(core): clean a lot of C4800 errors on Windows

parent 72326763
......@@ -227,7 +227,7 @@ static void call_updating(SalOp *op, bool_t is_update) {
ms_warning("call_updating: CallSession no longer exists");
return;
}
L_GET_PRIVATE(session)->updating(is_update);
L_GET_PRIVATE(session)->updating(!!is_update);
}
......
......@@ -73,7 +73,7 @@ bool Address::operator< (const Address &address) const {
bool Address::isValid () const {
L_D();
return static_cast<bool>(d->internalAddress);
d->internalAddress;
}
const string &Address::getScheme () const {
......@@ -162,7 +162,7 @@ bool Address::setTransport (Transport transport) {
bool Address::getSecure () const {
L_D();
return d->internalAddress ? sal_address_is_secure(d->internalAddress) : false;
return d->internalAddress && sal_address_is_secure(d->internalAddress);
}
bool Address::setSecure (bool enabled) {
......@@ -177,7 +177,7 @@ bool Address::setSecure (bool enabled) {
bool Address::isSip () const {
L_D();
return d->internalAddress ? sal_address_is_sip(d->internalAddress) : false;
return d->internalAddress && sal_address_is_sip(d->internalAddress);
}
const string &Address::getMethodParam () const {
......@@ -280,7 +280,7 @@ bool Address::setHeader (const string &headerName, const string &headerValue) {
bool Address::hasParam (const string &paramName) const {
L_D();
return sal_address_has_param(d->internalAddress, L_STRING_TO_C(paramName));
return !!sal_address_has_param(d->internalAddress, L_STRING_TO_C(paramName));
}
const string &Address::getParamValue (const string &paramName) const {
......@@ -317,7 +317,7 @@ bool Address::setParams (const string &params) {
bool Address::hasUriParam (const string &uriParamName) const {
L_D();
return sal_address_has_uri_param(d->internalAddress, L_STRING_TO_C(uriParamName));
return !!sal_address_has_uri_param(d->internalAddress, L_STRING_TO_C(uriParamName));
}
const string &Address::getUriParamValue (const string &uriParamName) const {
......
......@@ -102,7 +102,7 @@ bool_t linphone_address_get_secure (const LinphoneAddress *address) {
}
void linphone_address_set_secure (LinphoneAddress *address, bool_t enabled) {
L_GET_CPP_PTR_FROM_C_OBJECT(address)->setSecure(enabled);
L_GET_CPP_PTR_FROM_C_OBJECT(address)->setSecure(!!enabled);
}
bool_t linphone_address_is_sip (const LinphoneAddress *address) {
......
......@@ -118,24 +118,24 @@ bool_t linphone_call_params_early_media_sending_enabled (const LinphoneCallParam
}
void linphone_call_params_enable_early_media_sending (LinphoneCallParams *params, bool_t enabled) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableEarlyMediaSending(enabled);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableEarlyMediaSending(!!enabled);
}
void linphone_call_params_enable_low_bandwidth (LinphoneCallParams *params, bool_t enabled) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableLowBandwidth(enabled);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableLowBandwidth(!!enabled);
}
void linphone_call_params_enable_audio (LinphoneCallParams *params, bool_t enabled) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableAudio(enabled);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableAudio(!!enabled);
}
LinphoneStatus linphone_call_params_enable_realtime_text (LinphoneCallParams *params, bool_t yesno) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableRealtimeText(yesno);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableRealtimeText(!!yesno);
return 0;
}
void linphone_call_params_enable_video (LinphoneCallParams *params, bool_t enabled) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableVideo(enabled);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableVideo(!!enabled);
}
const char *linphone_call_params_get_custom_header (const LinphoneCallParams *params, const char *header_name) {
......@@ -309,7 +309,7 @@ void linphone_call_params_set_video_direction (LinphoneCallParams *params, Linph
}
void linphone_call_params_enable_audio_multicast (LinphoneCallParams *params, bool_t yesno) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableAudioMulticast(yesno);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableAudioMulticast(!!yesno);
}
bool_t linphone_call_params_audio_multicast_enabled (const LinphoneCallParams *params) {
......@@ -317,7 +317,7 @@ bool_t linphone_call_params_audio_multicast_enabled (const LinphoneCallParams *p
}
void linphone_call_params_enable_video_multicast (LinphoneCallParams *params, bool_t yesno) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableVideoMulticast(yesno);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableVideoMulticast(!!yesno);
}
bool_t linphone_call_params_video_multicast_enabled (const LinphoneCallParams *params) {
......@@ -333,7 +333,7 @@ bool_t linphone_call_params_avpf_enabled (const LinphoneCallParams *params) {
}
void linphone_call_params_enable_avpf (LinphoneCallParams *params, bool_t enable) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableAvpf(enable);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableAvpf(!!enable);
}
bool_t linphone_call_params_mandatory_media_encryption_enabled (const LinphoneCallParams *params) {
......@@ -341,7 +341,7 @@ bool_t linphone_call_params_mandatory_media_encryption_enabled (const LinphoneCa
}
void linphone_call_params_enable_mandatory_media_encryption (LinphoneCallParams *params, bool_t value) {
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableMandatoryMediaEncryption(value);
L_GET_CPP_PTR_FROM_C_OBJECT(params)->enableMandatoryMediaEncryption(!!value);
}
uint16_t linphone_call_params_get_avpf_rr_interval (const LinphoneCallParams *params) {
......@@ -369,7 +369,7 @@ bool_t linphone_call_params_get_in_conference (const LinphoneCallParams *params)
}
void linphone_call_params_set_in_conference (LinphoneCallParams *params, bool_t value) {
L_GET_PRIVATE_FROM_C_OBJECT(params)->setInConference(value);
L_GET_PRIVATE_FROM_C_OBJECT(params)->setInConference(!!value);
}
bool_t linphone_call_params_get_internal_call_update (const LinphoneCallParams *params) {
......@@ -377,7 +377,7 @@ bool_t linphone_call_params_get_internal_call_update (const LinphoneCallParams *
}
void linphone_call_params_set_internal_call_update (LinphoneCallParams *params, bool_t value) {
L_GET_PRIVATE_FROM_C_OBJECT(params)->setInternalCallUpdate(value);
L_GET_PRIVATE_FROM_C_OBJECT(params)->setInternalCallUpdate(!!value);
}
bool_t linphone_call_params_implicit_rtcp_fb_enabled (const LinphoneCallParams *params) {
......@@ -385,7 +385,7 @@ bool_t linphone_call_params_implicit_rtcp_fb_enabled (const LinphoneCallParams *
}
void linphone_call_params_enable_implicit_rtcp_fb (LinphoneCallParams *params, bool_t value) {
L_GET_PRIVATE_FROM_C_OBJECT(params)->enableImplicitRtcpFb(value);
L_GET_PRIVATE_FROM_C_OBJECT(params)->enableImplicitRtcpFb(!!value);
}
int linphone_call_params_get_down_bandwidth (const LinphoneCallParams *params) {
......@@ -445,7 +445,7 @@ bool_t linphone_call_params_get_update_call_when_ice_completed (const LinphoneCa
}
void linphone_call_params_set_update_call_when_ice_completed (LinphoneCallParams *params, bool_t value) {
L_GET_PRIVATE_FROM_C_OBJECT(params)->setUpdateCallWhenIceCompleted(value);
L_GET_PRIVATE_FROM_C_OBJECT(params)->setUpdateCallWhenIceCompleted(!!value);
}
void linphone_call_params_set_sent_vsize (LinphoneCallParams *params, MSVideoSize vsize) {
......@@ -469,7 +469,7 @@ bool_t linphone_call_params_get_no_user_consent (const LinphoneCallParams *param
}
void linphone_call_params_set_no_user_consent (LinphoneCallParams *params, bool_t value) {
L_GET_PRIVATE_FROM_C_OBJECT(params)->setNoUserConsent(value);
L_GET_PRIVATE_FROM_C_OBJECT(params)->setNoUserConsent(!!value);
}
// =============================================================================
......
......@@ -528,7 +528,7 @@ bool_t linphone_call_get_audio_muted (const LinphoneCall *call) {
}
void linphone_call_set_audio_muted (LinphoneCall *call, bool_t value) {
L_GET_PRIVATE_FROM_C_OBJECT(call)->setAudioMuted(value);
L_GET_PRIVATE_FROM_C_OBJECT(call)->setAudioMuted(!!value);
}
bool_t linphone_call_get_all_muted (const LinphoneCall *call) {
......@@ -700,7 +700,7 @@ const LinphoneCallParams *linphone_call_get_remote_params(LinphoneCall *call) {
}
void linphone_call_enable_camera (LinphoneCall *call, bool_t enable) {
L_GET_CPP_PTR_FROM_C_OBJECT(call)->enableCamera(enable);
L_GET_CPP_PTR_FROM_C_OBJECT(call)->enableCamera(!!enable);
}
bool_t linphone_call_camera_enabled (const LinphoneCall *call) {
......@@ -753,7 +753,7 @@ bool_t linphone_call_get_authentication_token_verified (const LinphoneCall *call
}
void linphone_call_set_authentication_token_verified (LinphoneCall *call, bool_t verified) {
L_GET_CPP_PTR_FROM_C_OBJECT(call)->setAuthenticationTokenVerified(verified);
L_GET_CPP_PTR_FROM_C_OBJECT(call)->setAuthenticationTokenVerified(!!verified);
}
void linphone_call_send_vfu_request (LinphoneCall *call) {
......@@ -1011,7 +1011,7 @@ void linphone_call_set_native_video_window_id (LinphoneCall *call, void *id) {
}
void linphone_call_enable_echo_cancellation (LinphoneCall *call, bool_t enable) {
L_GET_CPP_PTR_FROM_C_OBJECT(call)->enableEchoCancellation(enable);
L_GET_CPP_PTR_FROM_C_OBJECT(call)->enableEchoCancellation(!!enable);
}
bool_t linphone_call_echo_cancellation_enabled (const LinphoneCall *call) {
......@@ -1019,7 +1019,7 @@ bool_t linphone_call_echo_cancellation_enabled (const LinphoneCall *call) {
}
void linphone_call_enable_echo_limiter (LinphoneCall *call, bool_t val) {
L_GET_CPP_PTR_FROM_C_OBJECT(call)->enableEchoLimiter(val);
L_GET_CPP_PTR_FROM_C_OBJECT(call)->enableEchoLimiter(!!val);
}
bool_t linphone_call_echo_limiter_enabled (const LinphoneCall *call) {
......
......@@ -116,7 +116,7 @@ bool_t linphone_chat_message_is_secured(LinphoneChatMessage *msg) {
}
void linphone_chat_message_set_is_secured(LinphoneChatMessage *msg, bool_t secured) {
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->setIsSecured(secured);
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->setIsSecured(!!secured);
}
bool_t linphone_chat_message_is_outgoing(LinphoneChatMessage *msg) {
......@@ -206,7 +206,7 @@ bool_t linphone_chat_message_get_to_be_stored(const LinphoneChatMessage *msg) {
}
void linphone_chat_message_set_to_be_stored(LinphoneChatMessage *msg, bool_t to_be_stored) {
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->setIsToBeStored(to_be_stored);
L_GET_CPP_PTR_FROM_C_OBJECT(msg)->setIsToBeStored(!!to_be_stored);
}
belle_http_request_t * linphone_chat_message_get_http_request(LinphoneChatMessage *msg) {
......
......@@ -59,5 +59,5 @@ bool_t linphone_participant_is_admin (const LinphoneParticipant *participant) {
}
void linphone_participant_set_admin (LinphoneParticipant *participant, bool_t value) {
L_GET_CPP_PTR_FROM_C_OBJECT(participant)->setAdmin(value);
L_GET_CPP_PTR_FROM_C_OBJECT(participant)->setAdmin(!!value);
}
......@@ -239,18 +239,18 @@ void MediaSessionParams::initDefault (LinphoneCore *core) {
lError() << "LinphoneCore has video disabled for both capture and display, but video policy is to start the call with video. "
"This is a possible mis-use of the API. In this case, video is disabled in default LinphoneCallParams";
}
d->realtimeTextEnabled = linphone_core_realtime_text_enabled(core);
d->realtimeTextEnabled = !!linphone_core_realtime_text_enabled(core);
d->encryption = linphone_core_get_media_encryption(core);
d->avpfEnabled = (linphone_core_get_avpf_mode(core) == LinphoneAVPFEnabled);
d->_implicitRtcpFbEnabled = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_implicit_rtcp_fb", true);
d->_implicitRtcpFbEnabled = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_fb_implicit_rtcp_fb", true);
d->avpfRrInterval = static_cast<uint16_t>(linphone_core_get_avpf_rr_interval(core));
d->audioDirection = LinphoneMediaDirectionSendRecv;
d->videoDirection = LinphoneMediaDirectionSendRecv;
d->earlyMediaSendingEnabled = lp_config_get_int(linphone_core_get_config(core), "misc", "real_early_media", false);
d->audioMulticastEnabled = linphone_core_audio_multicast_enabled(core);
d->videoMulticastEnabled = linphone_core_video_multicast_enabled(core);
d->updateCallWhenIceCompleted = lp_config_get_int(linphone_core_get_config(core), "sip", "update_call_when_ice_completed", true);
d->mandatoryMediaEncryptionEnabled = linphone_core_is_media_encryption_mandatory(core);
d->earlyMediaSendingEnabled = !!lp_config_get_int(linphone_core_get_config(core), "misc", "real_early_media", false);
d->audioMulticastEnabled = !!linphone_core_audio_multicast_enabled(core);
d->videoMulticastEnabled = !!linphone_core_video_multicast_enabled(core);
d->updateCallWhenIceCompleted = !!lp_config_get_int(linphone_core_get_config(core), "sip", "update_call_when_ice_completed", true);
d->mandatoryMediaEncryptionEnabled = !!linphone_core_is_media_encryption_mandatory(core);
}
// -----------------------------------------------------------------------------
......
......@@ -354,7 +354,7 @@ void CallSessionPrivate::terminated () {
}
void CallSessionPrivate::updated (bool isUpdate) {
deferUpdate = lp_config_get_int(linphone_core_get_config(core), "sip", "defer_update_default", FALSE);
deferUpdate = !!lp_config_get_int(linphone_core_get_config(core), "sip", "defer_update_default", FALSE);
SalErrorInfo sei;
memset(&sei, 0, sizeof(sei));
switch (state) {
......
......@@ -790,7 +790,7 @@ void MediaSessionPrivate::initializeParamsAccordingToIncomingCallParams () {
*/
void MediaSessionPrivate::setCompatibleIncomingCallParams (SalMediaDescription *md) {
/* Handle AVPF, SRTP and DTLS */
params->enableAvpf(sal_media_description_has_avpf(md));
params->enableAvpf(!!sal_media_description_has_avpf(md));
if (destProxy)
params->setAvpfRrInterval(static_cast<uint16_t>(linphone_proxy_config_get_avpf_rr_interval(destProxy) * 1000));
else
......@@ -1193,7 +1193,7 @@ bool MediaSessionPrivate::generateB64CryptoKey (size_t keyLength, char *keyOut,
void MediaSessionPrivate::makeLocalMediaDescription () {
L_Q();
int maxIndex = 0;
bool rtcpMux = lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_mux", 0);
bool rtcpMux = !!lp_config_get_int(linphone_core_get_config(core), "rtp", "rtcp_mux", 0);
SalMediaDescription *md = sal_media_description_new();
SalMediaDescription *oldMd = localDesc;
......@@ -1492,7 +1492,7 @@ void MediaSessionPrivate::setupZrtpHash (SalMediaDescription *md) {
void MediaSessionPrivate::setupEncryptionKeys (SalMediaDescription *md) {
SalMediaDescription *oldMd = localDesc;
bool keepSrtpKeys = lp_config_get_int(linphone_core_get_config(core), "sip", "keep_srtp_keys", 1);
bool keepSrtpKeys = !!lp_config_get_int(linphone_core_get_config(core), "sip", "keep_srtp_keys", 1);
for (int i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i]))
continue;
......@@ -1906,7 +1906,7 @@ void MediaSessionPrivate::clearEarlyMediaDestinations () {
void MediaSessionPrivate::configureAdaptiveRateControl (MediaStream *ms, const OrtpPayloadType *pt, bool videoWillBeUsed) {
L_Q();
bool enabled = linphone_core_adaptive_rate_control_enabled(core);
bool enabled = !!linphone_core_adaptive_rate_control_enabled(core);
if (!enabled) {
media_stream_enable_adaptive_bitrate_control(ms, false);
return;
......@@ -2010,7 +2010,7 @@ RtpSession * MediaSessionPrivate::createAudioRtpIoSession () {
int jittcomp = lp_config_get_int(config, "sound", "rtp_jittcomp", 0); /* 0 means no jitter buffer */
rtp_session_set_jitter_compensation(rtpSession, jittcomp);
rtp_session_enable_jitter_buffer(rtpSession, (jittcomp > 0));
bool symmetric = lp_config_get_int(config, "sound", "rtp_symmetric", 0);
bool symmetric = !!lp_config_get_int(config, "sound", "rtp_symmetric", 0);
rtp_session_set_symmetric_rtp(rtpSession, symmetric);
return rtpSession;
}
......@@ -2158,15 +2158,15 @@ void MediaSessionPrivate::handleStreamEvents (int streamIndex) {
OrtpEventData *evd = ortp_event_get_data(ev);
if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED) {
if (streamIndex == mainAudioStreamIndex)
audioStreamEncryptionChanged(evd->info.zrtp_stream_encrypted);
audioStreamEncryptionChanged(!!evd->info.zrtp_stream_encrypted);
else if (streamIndex == mainVideoStreamIndex)
propagateEncryptionChanged();
} else if (evt == ORTP_EVENT_ZRTP_SAS_READY) {
if (streamIndex == mainAudioStreamIndex)
audioStreamAuthTokenReady(evd->info.zrtp_info.sas, evd->info.zrtp_info.verified);
audioStreamAuthTokenReady(evd->info.zrtp_info.sas, !!evd->info.zrtp_info.verified);
} else if (evt == ORTP_EVENT_DTLS_ENCRYPTION_CHANGED) {
if (streamIndex == mainAudioStreamIndex)
audioStreamEncryptionChanged(evd->info.dtls_stream_encrypted);
audioStreamEncryptionChanged(!!evd->info.dtls_stream_encrypted);
else if (streamIndex == mainVideoStreamIndex)
propagateEncryptionChanged();
} else if ((evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) || (evt == ORTP_EVENT_ICE_GATHERING_FINISHED)
......@@ -2420,7 +2420,7 @@ void MediaSessionPrivate::parameterizeEqualizer (AudioStream *stream) {
lWarning() << "'eq_gains' linphonerc parameter has no effect anymore. Please use 'mic_eq_gains' or 'spk_eq_gains' instead";
if (stream->mic_equalizer) {
MSFilter *f = stream->mic_equalizer;
bool enabled = lp_config_get_int(config, "sound", "mic_eq_active", 0);
bool enabled = !!lp_config_get_int(config, "sound", "mic_eq_active", 0);
ms_filter_call_method(f, MS_EQUALIZER_SET_ACTIVE, &enabled);
const char *gains = lp_config_get_string(config, "sound", "mic_eq_gains", nullptr);
if (enabled && gains) {
......@@ -2436,7 +2436,7 @@ void MediaSessionPrivate::parameterizeEqualizer (AudioStream *stream) {
}
if (stream->spk_equalizer) {
MSFilter *f = stream->spk_equalizer;
bool enabled = lp_config_get_int(config, "sound", "spk_eq_active", 0);
bool enabled = !!lp_config_get_int(config, "sound", "spk_eq_active", 0);
ms_filter_call_method(f, MS_EQUALIZER_SET_ACTIVE, &enabled);
const char *gains = lp_config_get_string(config, "sound", "spk_eq_gains", nullptr);
if (enabled && gains) {
......@@ -2542,7 +2542,7 @@ void MediaSessionPrivate::startAudioStream (LinphoneCallState targetState, bool
lWarning() << "No audio stream accepted?";
else {
const char *rtpAddr = (stream->rtp_addr[0] != '\0') ? stream->rtp_addr : resultDesc->addr;
bool isMulticast = ms_is_multicast(rtpAddr);
bool isMulticast = !!ms_is_multicast(rtpAddr);
bool ok = true;
currentParams->getPrivate()->setUsedAudioCodec(rtp_profile_get_payload(audioProfile, usedPt));
currentParams->enableAudio(true);
......@@ -2574,8 +2574,8 @@ void MediaSessionPrivate::startAudioStream (LinphoneCallState targetState, bool
}
}
/* If playfile are supplied don't use soundcards */
bool useRtpIo = lp_config_get_int(linphone_core_get_config(core), "sound", "rtp_io", false);
bool useRtpIoEnableLocalOutput = lp_config_get_int(linphone_core_get_config(core), "sound", "rtp_io_enable_local_output", false);
bool useRtpIo = !!lp_config_get_int(linphone_core_get_config(core), "sound", "rtp_io", false);
bool useRtpIoEnableLocalOutput = !!lp_config_get_int(linphone_core_get_config(core), "sound", "rtp_io_enable_local_output", false);
if (core->use_files || (useRtpIo && !useRtpIoEnableLocalOutput)) {
captcard = playcard = nullptr;
}
......@@ -2589,7 +2589,7 @@ void MediaSessionPrivate::startAudioStream (LinphoneCallState targetState, bool
captcard = playcard = nullptr;
}
#endif
bool useEc = (captcard == nullptr) ? false : linphone_core_echo_cancellation_enabled(core);
bool useEc = captcard && linphone_core_echo_cancellation_enabled(core);
audio_stream_enable_echo_canceller(audioStream, useEc);
if (playcard && (stream->max_rate > 0))
ms_snd_card_set_preferred_sample_rate(playcard, stream->max_rate);
......@@ -3634,12 +3634,12 @@ void MediaSessionPrivate::handleIncomingReceivedStateInIncomingNotification () {
L_Q();
/* Try to be best-effort in giving real local or routable contact address for 100Rel case */
setContactOp();
bool proposeEarlyMedia = lp_config_get_int(linphone_core_get_config(core), "sip", "incoming_calls_early_media", false);
bool proposeEarlyMedia = !!lp_config_get_int(linphone_core_get_config(core), "sip", "incoming_calls_early_media", false);
if (proposeEarlyMedia)
q->acceptEarlyMedia();
else
sal_call_notify_ringing(op, false);
if (sal_call_get_replaces(op) && lp_config_get_int(linphone_core_get_config(core), "sip", "auto_answer_replacing_calls", 1))
if (sal_call_get_replaces(op) && !!lp_config_get_int(linphone_core_get_config(core), "sip", "auto_answer_replacing_calls", 1))
q->accept();
}
......@@ -3821,15 +3821,15 @@ void MediaSessionPrivate::updateCurrentParams () const {
currentParams->setAudioDirection(sd ? MediaSessionParamsPrivate::salStreamDirToMediaDirection(sd->dir) : LinphoneMediaDirectionInactive);
if (currentParams->getAudioDirection() != LinphoneMediaDirectionInactive) {
const char *rtpAddr = (sd->rtp_addr[0] != '\0') ? sd->rtp_addr : md->addr;
currentParams->enableAudioMulticast(ms_is_multicast(rtpAddr));
currentParams->enableAudioMulticast(!!ms_is_multicast(rtpAddr));
} else
currentParams->enableAudioMulticast(false);
sd = sal_media_description_find_best_stream(md, SalVideo);
currentParams->getPrivate()->enableImplicitRtcpFb(sd ? sal_stream_description_has_implicit_avpf(sd): false);
currentParams->getPrivate()->enableImplicitRtcpFb(sd && sal_stream_description_has_implicit_avpf(sd));
currentParams->setVideoDirection(sd ? MediaSessionParamsPrivate::salStreamDirToMediaDirection(sd->dir) : LinphoneMediaDirectionInactive);
if (currentParams->getVideoDirection() != LinphoneMediaDirectionInactive) {
const char *rtpAddr = (sd->rtp_addr[0] != '\0') ? sd->rtp_addr : md->addr;
currentParams->enableVideoMulticast(ms_is_multicast(rtpAddr));
currentParams->enableVideoMulticast(!!ms_is_multicast(rtpAddr));
} else
currentParams->enableVideoMulticast(false);
}
......@@ -3876,7 +3876,7 @@ void MediaSessionPrivate::accept (const MediaSessionParams *csp) {
LinphoneStatus MediaSessionPrivate::acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const string &stateInfo) {
L_Q();
SalMediaDescription *desc = sal_call_get_remote_media_description(op);
bool keepSdpVersion = lp_config_get_int(linphone_core_get_config(core), "sip", "keep_sdp_version", 0);
bool keepSdpVersion = !!lp_config_get_int(linphone_core_get_config(core), "sip", "keep_sdp_version", 0);
if (keepSdpVersion && (desc->session_id == remoteSessionId) && (desc->session_ver == remoteSessionVer)) {
/* Remote has sent an INVITE with the same SDP as before, so send a 200 OK with the same SDP as before. */
lWarning() << "SDP version has not changed, send same SDP as before";
......@@ -4401,20 +4401,19 @@ bool MediaSession::cameraEnabled () const {
bool MediaSession::echoCancellationEnabled () const {
L_D();
if (d->audioStream && d->audioStream->ec) {
bool val;
ms_filter_call_method(d->audioStream->ec, MS_ECHO_CANCELLER_GET_BYPASS_MODE, &val);
return !val;
} else
return linphone_core_echo_cancellation_enabled(d->core);
if (!d->audioStream || !d->audioStream->ec)
return !!linphone_core_echo_cancellation_enabled(d->core);
bool val;
ms_filter_call_method(d->audioStream->ec, MS_ECHO_CANCELLER_GET_BYPASS_MODE, &val);
return !val;
}
bool MediaSession::echoLimiterEnabled () const {
L_D();
if (d->audioStream)
return d->audioStream->el_type !=ELInactive;
else
return linphone_core_echo_limiter_enabled(d->core);
return !!linphone_core_echo_limiter_enabled(d->core);
}
void MediaSession::enableCamera (bool value) {
......
......@@ -34,7 +34,7 @@ LINPHONE_BEGIN_NAMESPACE
bool IceAgent::candidatesGathered () const {
if (!iceSession)
return false;
return ice_session_candidates_gathered(iceSession);
return !!ice_session_candidates_gathered(iceSession);
}
void IceAgent::checkSession (IceRole role, bool isReinvite) {
......@@ -107,7 +107,7 @@ bool IceAgent::hasCompletedCheckList () const {
switch (ice_session_state(iceSession)) {
case IS_Completed:
case IS_Failed:
return ice_session_has_completed_check_list(iceSession);
return !!ice_session_has_completed_check_list(iceSession);
default:
return false;
}
......@@ -213,7 +213,7 @@ void IceAgent::updateFromRemoteMediaDescription (
if (!iceParamsFoundInRemoteMediaDescription(remoteDesc)) {
// Response from remote does not contain mandatory ICE attributes, delete the session.
deleteSession();
mediaSession.getPrivate()->enableSymmetricRtp(linphone_core_symmetric_rtp_enabled(mediaSession.getPrivate()->getCore()));
mediaSession.getPrivate()->enableSymmetricRtp(!!linphone_core_symmetric_rtp_enabled(mediaSession.getPrivate()->getCore()));
return;
}
......@@ -236,7 +236,7 @@ void IceAgent::updateFromRemoteMediaDescription (
if (ice_session_nb_check_lists(iceSession) == 0) {
deleteSession();
mediaSession.getPrivate()->enableSymmetricRtp(linphone_core_symmetric_rtp_enabled(mediaSession.getPrivate()->getCore()));
mediaSession.getPrivate()->enableSymmetricRtp(!!linphone_core_symmetric_rtp_enabled(mediaSession.getPrivate()->getCore()));
}
}
......@@ -302,7 +302,7 @@ void IceAgent::updateLocalMediaDescriptionFromIce (SalMediaDescription *desc) {
}
}
if (firstCl)
result = ice_check_list_selected_valid_local_candidate(firstCl, &rtpCandidate, nullptr);
result = !!ice_check_list_selected_valid_local_candidate(firstCl, &rtpCandidate, nullptr);
if (result)
strncpy(desc->addr, rtpCandidate->taddr.ip, sizeof(desc->addr));
else
......@@ -320,13 +320,13 @@ void IceAgent::updateLocalMediaDescriptionFromIce (SalMediaDescription *desc) {
if (ice_check_list_state(cl) == ICL_Completed) {
LinphoneConfig *config = linphone_core_get_config(mediaSession.getPrivate()->getCore());
// TODO: Remove `ice_uses_nortpproxy` option, let's say in December 2018.
bool useNoRtpProxy = lp_config_get_int(config, "sip", "ice_uses_nortpproxy", false);
bool useNoRtpProxy = !!lp_config_get_int(config, "sip", "ice_uses_nortpproxy", false);
if (useNoRtpProxy)
stream->set_nortpproxy = true;
result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(iceSession, i), &rtpCandidate, &rtcpCandidate);
result = !!ice_check_list_selected_valid_local_candidate(ice_session_check_list(iceSession, i), &rtpCandidate, &rtcpCandidate);
} else {
stream->set_nortpproxy = false;
result = ice_check_list_default_local_candidate(ice_session_check_list(iceSession, i), &rtpCandidate, &rtcpCandidate);
result = !!ice_check_list_default_local_candidate(ice_session_check_list(iceSession, i), &rtpCandidate, &rtcpCandidate);
}
if (result) {
strncpy(stream->rtp_addr, rtpCandidate->taddr.ip, sizeof(stream->rtp_addr));
......
......@@ -52,7 +52,7 @@ public:
bool hasCompleted () const;
bool hasCompletedCheckList () const;
bool hasSession () const {
return iceSession;
return !!iceSession;
}
bool isControlling () const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment