From f46f1fbe77630dfa79d58099b7684d6a97e5fa99 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 7 Sep 2015 17:38:32 +0200 Subject: [PATCH] linphonecall: LinphoneCoreCallStateChangedCb should never receive NULL as last argument "message" --- coreapi/linphonecall.c | 28 +++++++++++++++++----------- coreapi/linphonecore.c | 6 +++--- coreapi/linphonecore.h | 2 +- coreapi/private.h | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 45a78f47f..b5e8d62b9 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -584,7 +584,7 @@ static const char *linphone_call_get_public_ip_for_stream(LinphoneCall *call, in static void force_streams_dir_according_to_state(LinphoneCall *call, SalMediaDescription *md){ int i; - + switch (call->state){ case LinphoneCallPausing: case LinphoneCallPaused: @@ -593,7 +593,7 @@ static void force_streams_dir_according_to_state(LinphoneCall *call, SalMediaDes return; break; } - + for (i=0; i<2; ++i){ SalStreamDescription *sd = &md->streams[i]; sd->dir = SalStreamSendOnly; @@ -1349,7 +1349,13 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const linphone_call_cancel_dtmfs(call); } } - linphone_core_notify_call_state_changed(lc,call,cstate,message); + if (!message) { + ms_error("%s(): You must fill a reason when changing call state (from %s o %s)." + , __FUNCTION__ + , linphone_call_state_to_string(call->prevstate) + , linphone_call_state_to_string(call->state)); + } + linphone_core_notify_call_state_changed(lc,call,cstate,message?message:""); linphone_reporting_call_state_updated(call); if (cstate==LinphoneCallReleased) {/*shall be performed after app notification*/ linphone_call_set_released(call); @@ -2696,7 +2702,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, LinphoneCallSta io.input.type = MSResourceFile; io.input.file = playfile; } - + } if (ok == TRUE) { audio_stream_start_from_io(call->audiostream, @@ -2788,7 +2794,7 @@ static void linphone_call_start_video_stream(LinphoneCall *call, LinphoneCallSta MediaStreamDir dir= MediaStreamSendRecv; bool_t is_inactive=FALSE; MSWebCam *cam; - + call->current_params->video_codec = rtp_profile_get_payload(call->video_profile, used_pt); call->current_params->has_video=TRUE; @@ -2974,7 +2980,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, LinphoneCallState nex call->all_muted = FALSE; break; } - + call->current_params->audio_codec = NULL; call->current_params->video_codec = NULL; @@ -3124,7 +3130,7 @@ static void update_rtp_stats(LinphoneCall *call, int stream_index) { if (stream_index >= linphone_call_get_stream_count(call)) { return; } - + if (call->sessions[stream_index].rtp_session) { const rtp_stats_t *stats = rtp_session_get_stats(call->sessions[stream_index].rtp_session); memcpy(&call->stats[stream_index].rtp_stats, stats, sizeof(*stats)); @@ -3527,7 +3533,7 @@ rtp_stats_t linphone_call_stats_get_rtp_stats(const LinphoneCallStats *stats) { if (stats) { memcpy(&rtp_stats, &stats->rtp_stats, sizeof(stats->rtp_stats)); } - + return rtp_stats; } @@ -4208,7 +4214,7 @@ MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index) RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index) { RtpTransport *meta_rtp; RtpTransport *meta_rtcp; - + if (!call || stream_index < 0 || stream_index >= linphone_call_get_stream_count(call)) { return NULL; } @@ -4220,11 +4226,11 @@ RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int strea RtpTransport* linphone_call_get_meta_rtcp_transport(LinphoneCall *call, int stream_index) { RtpTransport *meta_rtp; RtpTransport *meta_rtcp; - + if (!call || stream_index < 0 || stream_index >= linphone_call_get_stream_count(call)) { return NULL; } rtp_session_get_transports(call->sessions[stream_index].rtp_session, &meta_rtp, &meta_rtcp); return meta_rtcp; -} \ No newline at end of file +} diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3d124d147..1c238a4aa 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3320,7 +3320,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho #endif //defined(VIDEO_ENABLED) && defined(BUILD_UPNP) if ((err = linphone_core_start_update_call(lc, call)) && call->state!=initial_state) { /*Restore initial state*/ - linphone_call_set_state(call,initial_state,NULL); + linphone_call_set_state(call,initial_state,"Restore initial state"); } }else{ @@ -3350,7 +3350,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho * the call state notification, to deactivate the automatic answer that would just confirm the audio but reject the video. * Then, when the user responds to dialog prompt, it becomes possible to call linphone_core_accept_call_update() to answer * the reINVITE, with eventually video enabled in the LinphoneCallParams argument. - * + * * The #LinphoneCallUpdatedByRemote notification can also arrive when receiving an INVITE without SDP. In such case, an unchanged offer is made * in the 200Ok, and when the ACK containing the SDP answer is received, #LinphoneCallUpdatedByRemote is triggered to notify the application of possible * changes in the media session. However in such case defering the update has no meaning since we just generating an offer. @@ -6568,7 +6568,7 @@ static void linphone_core_run_hooks(LinphoneCore *lc){ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data){ linphone_task_list_remove(&lc->hooks, hook, hook_data); - + } void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 642492150..c6d05152e 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1766,7 +1766,7 @@ typedef void (*LinphoneCoreGlobalStateChangedCb)(LinphoneCore *lc, LinphoneGloba * @param lc the LinphoneCore * @param call the call object whose state is changed. * @param cstate the new state of the call - * @param message an informational message about the state. + * @param message a non NULL informational message about the state. */ typedef void (*LinphoneCoreCallStateChangedCb)(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message); diff --git a/coreapi/private.h b/coreapi/private.h index 942f14f2c..6d5bc08d3 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -79,7 +79,7 @@ extern "C" { #endif #include - + #ifndef _ #define _(String) dgettext(GETTEXT_PACKAGE,String) #endif