From aacd7bb5a246de1b366f935d8947d1ca1df6f99b Mon Sep 17 00:00:00 2001 From: Jehan Monnier <jehan.monnier@linphone.org> Date: Mon, 10 Feb 2014 17:34:56 +0100 Subject: [PATCH] protect call tester add_video against crash when call has fail --- coreapi/bellesip_sal/sal_sdp.c | 2 +- tester/call_tester.c | 38 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/coreapi/bellesip_sal/sal_sdp.c b/coreapi/bellesip_sal/sal_sdp.c index dd7794b26a..76d834dab8 100644 --- a/coreapi/bellesip_sal/sal_sdp.c +++ b/coreapi/bellesip_sal/sal_sdp.c @@ -379,7 +379,7 @@ int sdp_to_media_description ( belle_sdp_session_description_t *session_desc, S ; mime_param_it=mime_param_it->next ) { mime_param=BELLE_SDP_MIME_PARAMETER ( mime_param_it->data ) - pt=payload_type_new(); + pt=payload_type_new(); payload_type_set_number ( pt,belle_sdp_mime_parameter_get_media_format ( mime_param ) ); pt->clock_rate=belle_sdp_mime_parameter_get_rate ( mime_param ); pt->mime_type=ms_strdup ( belle_sdp_mime_parameter_get_type ( mime_param ) ); diff --git a/tester/call_tester.c b/tester/call_tester.c index f32d41b02d..5a64dab4e0 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -672,25 +672,25 @@ static bool_t add_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee) stats initial_caller_stat=caller->stat; stats initial_callee_stat=callee->stat; - call_obj = linphone_core_get_current_call(callee->lc); - callee_params = linphone_call_params_copy(linphone_call_get_current_params(call_obj)); - /*add video*/ - linphone_call_params_enable_video(callee_params,TRUE); - linphone_core_update_call(callee->lc,call_obj,callee_params); - - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); - CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning+1)); - - CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); - CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); - - linphone_call_set_next_video_frame_decoded_callback(call_obj,linphone_call_cb,callee->lc); - /*send vfu*/ - linphone_call_send_vfu_request(call_obj); - return wait_for(caller->lc,callee->lc,&callee->stat.number_of_IframeDecoded,initial_callee_stat.number_of_IframeDecoded+1); - + if ((call_obj = linphone_core_get_current_call(callee->lc))) { + callee_params = linphone_call_params_copy(linphone_call_get_current_params(call_obj)); + /*add video*/ + linphone_call_params_enable_video(callee_params,TRUE); + linphone_core_update_call(callee->lc,call_obj,callee_params); + + CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallUpdatedByRemote,initial_caller_stat.number_of_LinphoneCallUpdatedByRemote+1)); + CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallUpdating,initial_callee_stat.number_of_LinphoneCallUpdating+1)); + CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&callee->stat.number_of_LinphoneCallStreamsRunning,initial_callee_stat.number_of_LinphoneCallStreamsRunning+1)); + CU_ASSERT_TRUE(wait_for(caller->lc,callee->lc,&caller->stat.number_of_LinphoneCallStreamsRunning,initial_caller_stat.number_of_LinphoneCallStreamsRunning+1)); + + CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(callee->lc)))); + CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(caller->lc)))); + + linphone_call_set_next_video_frame_decoded_callback(call_obj,linphone_call_cb,callee->lc); + /*send vfu*/ + linphone_call_send_vfu_request(call_obj); + return wait_for(caller->lc,callee->lc,&callee->stat.number_of_IframeDecoded,initial_callee_stat.number_of_IframeDecoded+1); + } else return -1; } static void call_with_video_added(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); -- GitLab