Commit 29303a87 authored by Julien Wadel's avatar Julien Wadel
Browse files

Chat Room : Avoid to add a ref when there is no messages on search - Add PDB...

 Chat Room : Avoid to add a ref when there is no messages on search - Add PDB of liblinphone_tester - Group Chat Message test : Fix memory corruption by moving unref message to a better place - Build group chat secure tester only if Lime X3DH is build - Add Assert to end test if some pointers are null (append when there is an issue with building encrypted room) - add tests on pointers - remove calls cache before destroying factory - ICE : switch stream after handling ice event as it can change it - Fix tests
parent ab8a9ae9
......@@ -26,6 +26,7 @@ This changelog file was started on October 2019. Previous changes were more or l
- Magic search bar not looking in all friends lists.
- Error IMDN in LIME chat rooms not properly sent.
- Chat message lost during attachment auto download if Core stopped during the process.
- Windows tests.
## [4.4.0] 2020-06-16
......
......@@ -6760,6 +6760,10 @@ static void _linphone_core_stop_async_end(LinphoneCore *lc) {
linphone_core_zrtp_cache_close(lc);
ms_bandwidth_controller_destroy(lc->bw_controller);
lc->bw_controller = NULL;
if (lc->callsCache) {// Ensure to remove cache before destroying factory
bctbx_list_free_with_data(lc->callsCache, (bctbx_list_free_func)linphone_call_unref);
lc->callsCache = NULL;
}
ms_factory_destroy(lc->factory);
lc->factory = NULL;
......
......@@ -217,24 +217,25 @@ void linphone_call_stats_update (LinphoneCallStats *stats, MediaStream *stream)
void linphone_call_stats_fill (LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev) {
OrtpEventType evt=ortp_event_get_type(ev);
OrtpEventData *evd=ortp_event_get_data(ev);
if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) {
stats->round_trip_delay = rtp_session_get_round_trip_propagation(ms->sessions.rtp_session);
if(stats->received_rtcp != NULL)
freemsg(stats->received_rtcp);
stats->received_rtcp = evd->packet;
stats->rtcp_received_via_mux = evd->info.socket_type == OrtpRTPSocket;
evd->packet = NULL;
stats->updated = LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE;
linphone_call_stats_update(stats,ms);
} else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) {
memcpy(&stats->jitter_stats, rtp_session_get_jitter_stats(ms->sessions.rtp_session), sizeof(jitter_stats_t));
if (stats->sent_rtcp != NULL)
freemsg(stats->sent_rtcp);
stats->sent_rtcp = evd->packet;
evd->packet = NULL;
stats->updated = LINPHONE_CALL_STATS_SENT_RTCP_UPDATE;
linphone_call_stats_update(stats,ms);
if(ms->sessions.rtp_session){
if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) {
stats->round_trip_delay = rtp_session_get_round_trip_propagation(ms->sessions.rtp_session);
if(stats->received_rtcp != NULL)
freemsg(stats->received_rtcp);
stats->received_rtcp = evd->packet;
stats->rtcp_received_via_mux = evd->info.socket_type == OrtpRTPSocket;
evd->packet = NULL;
stats->updated = LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE;
linphone_call_stats_update(stats,ms);
} else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) {
memcpy(&stats->jitter_stats, rtp_session_get_jitter_stats(ms->sessions.rtp_session), sizeof(jitter_stats_t));
if (stats->sent_rtcp != NULL)
freemsg(stats->sent_rtcp);
stats->sent_rtcp = evd->packet;
evd->packet = NULL;
stats->updated = LINPHONE_CALL_STATS_SENT_RTCP_UPDATE;
linphone_call_stats_update(stats,ms);
}
}
}
......
......@@ -308,7 +308,11 @@ LinphoneChatMessage *linphone_chat_room_get_last_message_in_history(LinphoneChat
}
LinphoneChatMessage *linphone_chat_room_find_message (LinphoneChatRoom *cr, const char *message_id) {
return linphone_chat_message_ref(L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->findChatMessage(message_id)));
auto cppPtr = L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(cr)->findChatMessage(message_id));
if(cppPtr)
return linphone_chat_message_ref(cppPtr);
else
return nullptr;
}
LinphoneChatRoomState linphone_chat_room_get_state (const LinphoneChatRoom *cr) {
......
......@@ -940,7 +940,7 @@ void MS2Stream::dtlsEncryptionChanged(){
}
void MS2Stream::handleEvents () {
MediaStream *ms = getMediaStream();
MediaStream *ms = getMediaStream(), *newMs = ms;
if (ms) {
switch(ms->type){
case MSAudio:
......@@ -977,7 +977,6 @@ void MS2Stream::handleEvents () {
} while (rtcp_next_packet(evd->packet));
rtcp_rewind(evd->packet);
}
if (ms)
linphone_call_stats_fill(mStats, ms, ev);
switch(evt){
......@@ -995,6 +994,7 @@ void MS2Stream::handleEvents () {
case ORTP_EVENT_ICE_RESTART_NEEDED:
/* ICE events are notified directly to the IceService. */
getIceService().handleIceEvent(ev);
newMs = getMediaStream();// Ice can change the stream and free the old one. Ensure to have an existing stream.
break;
}
notifyStatsUpdated();
......@@ -1002,6 +1002,10 @@ void MS2Stream::handleEvents () {
/* Let subclass handle the event.*/
handleEvent(ev);
ortp_event_destroy(ev);
if( newMs != ms){// Stream have been changed. Rehandle events with this one
handleEvents();
return;
}
}
}
......
......@@ -222,8 +222,7 @@ set(SOURCE_FILES_C
dtmf_tester.c
eventapi_tester.c
flexisip_tester.c
group_chat_tester.c
group_chat_secure_tester.c
group_chat_tester.c
group_chat_ephemeral_tester.c
liblinphone_tester.c
log_collection_tester.c
......@@ -245,6 +244,9 @@ set(SOURCE_FILES_C
video_quality_tester.c
shared_core_tester.c
)
if(ENABLE_LIME_X3DH)
list(APPEND SOURCE_FILES_C group_chat_secure_tester.c)
endif()
set(SOURCE_FILES_CXX
clonable-object-tester.cpp
......@@ -392,6 +394,14 @@ if(NOT ANDROID AND NOT CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set_target_properties(liblinphone_tester PROPERTIES C_STANDARD 99)
target_include_directories(liblinphone_tester PRIVATE ${LINPHONE_INCLUDE_DIRS})
target_link_libraries(liblinphone_tester ${LINPHONE_LIBS_FOR_TOOLS} ${OTHER_LIBS_FOR_TESTER})
if(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
install(FILES $<TARGET_PDB_FILE:liblinphone_tester>
DESTINATION ${CMAKE_INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
endif()
install(TARGETS liblinphone_tester
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
......
......@@ -268,6 +268,7 @@ static void call_with_disconnecting_device_base(bool_t before_ringback, bool_t d
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
register_device(marie, &dummy_test_snd_card_desc);
register_device(marie, &dummy2_test_snd_card_desc);
// Choose Marie's audio devices
// Use linphone_core_get_extended_audio_devices instead of linphone_core_get_audio_devices because we added 2 BT devices, therefore we want the raw list
......@@ -312,7 +313,7 @@ static void call_with_disconnecting_device_base(bool_t before_ringback, bool_t d
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallIncomingReceived,1,5000));
LinphoneCall * pauline_call = linphone_core_get_current_call(pauline->lc);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if(!BC_ASSERT_PTR_NOT_NULL(pauline_call)) goto end;
linphone_call_ref(pauline_call);
// Marie should hear ringback as well
......@@ -364,6 +365,7 @@ static void call_with_disconnecting_device_base(bool_t before_ringback, bool_t d
// After call, unref the sound card
linphone_audio_device_unref(current_dev);
end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
......@@ -490,7 +492,7 @@ static void simple_call_with_audio_device_change_base(bool_t before_ringback, bo
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallIncomingReceived,1,5000));
LinphoneCall * pauline_call = linphone_core_get_current_call(pauline->lc);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if(!BC_ASSERT_PTR_NOT_NULL(pauline_call)) goto end;
linphone_call_ref(pauline_call);
// Marie should hear ringback as well
......@@ -527,6 +529,7 @@ static void simple_call_with_audio_device_change_base(bool_t before_ringback, bo
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCoreLastCallEnded, 1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCoreLastCallEnded, 1, int, "%d");
end:
// After call, unref the sound card
linphone_audio_device_unref(dev0);
linphone_audio_device_unref(dev1);
......@@ -680,7 +683,7 @@ static void simple_call_with_audio_device_change_during_call_pause_base(bool_t c
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallIncomingReceived,1,5000));
LinphoneCall * pauline_call = linphone_core_get_current_call(pauline->lc);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if(!BC_ASSERT_PTR_NOT_NULL(pauline_call)) goto end;
// Marie should hear ringback as well
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,5000));
......@@ -748,6 +751,7 @@ static void simple_call_with_audio_device_change_during_call_pause_base(bool_t c
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCoreLastCallEnded, 1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCoreLastCallEnded, 1, int, "%d");
end:
// After call, unref the sound card
linphone_audio_device_unref(marie_dev0);
linphone_audio_device_unref(marie_dev1);
......@@ -944,7 +948,7 @@ static void simple_conference_with_audio_device_change_base(bool_t during_setup,
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallOutgoingProgress,noParticipants,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallIncomingReceived,1,10000));
LinphoneCall *pauline_call = linphone_core_get_current_call(pauline->lc);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if(!BC_ASSERT_PTR_NOT_NULL(pauline_call)) goto end;
linphone_call_accept(pauline_call);
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,noParticipants,10000));
......@@ -974,10 +978,12 @@ static void simple_conference_with_audio_device_change_base(bool_t during_setup,
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallReleased,noParticipants,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallReleased,1,1000));
end:
linphone_conference_unref(conf);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(marie);
linphone_audio_device_unref(dev0);
linphone_audio_device_unref(dev1);
......@@ -1179,7 +1185,7 @@ static void simple_conference_with_audio_device_change_during_pause_base(bool_t
BC_ASSERT_TRUE(linphone_call_params_get_local_conference_mode(linphone_call_get_current_params((LinphoneCall*)it->data)) == TRUE);
}
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if(!BC_ASSERT_PTR_NOT_NULL(pauline_call)) goto end;
// wait a bit before changing device
wait_for_list(lcs,NULL,0,2000);
......@@ -1222,19 +1228,23 @@ static void simple_conference_with_audio_device_change_during_pause_base(bool_t
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallReleased,noParticipants,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallReleased,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallReleased,1,1000));
end:
linphone_conference_unref(conf);
// After call, unref the sound card
linphone_audio_device_unref(marie_dev0);
linphone_audio_device_unref(marie_dev1);
linphone_audio_device_unref(marie_current_dev);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(laure);
linphone_audio_device_unref(pauline_dev0);
linphone_audio_device_unref(pauline_dev1);
linphone_audio_device_unref(pauline_current_dev);
linphone_core_manager_destroy(pauline);
linphone_audio_device_unref(marie_dev0);
linphone_audio_device_unref(marie_dev1);
linphone_audio_device_unref(marie_current_dev);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(laure);
bctbx_list_free(participants);
bctbx_list_free(lcs);
......
......@@ -312,6 +312,9 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
marie_call_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
if (!BC_ASSERT_PTR_NOT_NULL(marie_call_pauline)) goto end;
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie));
if (!BC_ASSERT_TRUE(call(marie,laure))) goto end;
......@@ -607,6 +610,7 @@ static void video_conference_by_merging_calls(void){
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingProgress,1,10000));
if (BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallIncomingReceived,1,10000))){
if (!BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc))) goto end;
linphone_call_accept(linphone_core_get_current_call(pauline->lc));
}else goto end;
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,5000));
......@@ -618,6 +622,7 @@ static void video_conference_by_merging_calls(void){
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingProgress,2,10000));
if (BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,10000))){
if (!BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc))) goto end;
linphone_call_accept(linphone_core_get_current_call(laure->lc));
}else goto end;
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,2,5000));
......@@ -696,9 +701,9 @@ static void video_conference_by_merging_calls(void){
end:
if (conf) linphone_conference_unref(conf);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
bctbx_list_free(participants);
bctbx_list_free(lcs);
......@@ -849,6 +854,9 @@ static void simple_call_transfer(void) {
BC_ASSERT_TRUE(call(marie,pauline));
marie_calling_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
if (!BC_ASSERT_PTR_NOT_NULL(marie_calling_pauline)) goto end;
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
......@@ -871,6 +879,7 @@ static void simple_call_transfer(void) {
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000));
if (!BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc))) goto end;
linphone_call_accept(linphone_core_get_current_call(laure->lc));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000));
......@@ -911,6 +920,7 @@ static void unattended_call_transfer(void) {
BC_ASSERT_TRUE(call(marie,pauline));
pauline_called_by_marie=linphone_core_get_current_call(marie->lc);
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
......@@ -928,6 +938,7 @@ static void unattended_call_transfer(void) {
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
if (!BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(laure->lc))) goto end;
linphone_call_accept(linphone_core_get_current_call(laure->lc));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,3000));
......@@ -938,6 +949,7 @@ static void unattended_call_transfer(void) {
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000));
end_call(laure, pauline);
end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
......@@ -957,6 +969,8 @@ static void unattended_call_transfer_with_error(void) {
if (call_ok){
pauline_called_by_marie=linphone_core_get_current_call(marie->lc);
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
......@@ -979,9 +993,9 @@ static void unattended_call_transfer_with_error(void) {
end_call(marie, pauline);
}
linphone_core_manager_destroy(marie);
end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
bctbx_list_free(lcs);
}
......@@ -1009,6 +1023,8 @@ static void call_transfer_existing_call(bool_t outgoing_call, bool_t auto_answer
if (call_ok){
marie_call_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
if (!BC_ASSERT_PTR_NOT_NULL(marie_call_pauline)) goto end;
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
/*marie pause pauline*/
if (!BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie))) {
goto end;
......@@ -1030,6 +1046,8 @@ static void call_transfer_existing_call(bool_t outgoing_call, bool_t auto_answer
marie_call_laure=linphone_core_get_current_call(marie->lc);
laure_called_by_marie=linphone_core_get_current_call(laure->lc);
if (!BC_ASSERT_PTR_NOT_NULL(marie_call_laure)) goto end;
if (!BC_ASSERT_PTR_NOT_NULL(laure_called_by_marie)) goto end;
/*marie pause laure*/
BC_ASSERT_TRUE(pause_call_1(marie,marie_call_laure,laure,laure_called_by_marie));
......@@ -1078,9 +1096,9 @@ static void call_transfer_existing_call(bool_t outgoing_call, bool_t auto_answer
end_call(pauline, laure);
}
end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
bctbx_list_free(lcs);
}
......@@ -1117,6 +1135,8 @@ static void call_transfer_existing_ringing_call(void) {
if (call_ok) {
marie_call_pauline = linphone_core_get_current_call(marie->lc);
pauline_called_by_marie = linphone_core_get_current_call(pauline->lc);
if (!BC_ASSERT_PTR_NOT_NULL(marie_call_pauline)) goto end;
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
/* marie pauses pauline */
if (!BC_ASSERT_TRUE(pause_call_1(marie, marie_call_pauline, pauline, pauline_called_by_marie))) goto end;
......@@ -1126,6 +1146,7 @@ static void call_transfer_existing_ringing_call(void) {
BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, initial_marie_stats.number_of_LinphoneCallOutgoingRinging + 1));
BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallIncomingReceived, 1, 2000));
laure_call = linphone_core_get_current_call(laure->lc);
if (!BC_ASSERT_PTR_NOT_NULL(laure_call)) goto end;
linphone_call_transfer_to_another(marie_call_pauline, marie_call_laure);
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallRefered, 1, 2000));
......@@ -1166,9 +1187,9 @@ static void call_transfer_existing_ringing_call(void) {
}
end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
bctbx_list_free(lcs);
}
......@@ -1192,6 +1213,8 @@ static void eject_from_3_participants_conference(LinphoneCoreManager *marie, Lin
if (!BC_ASSERT_TRUE(call(marie,pauline))) goto end;
marie_call_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
if (!BC_ASSERT_PTR_NOT_NULL(marie_call_pauline)) goto end;
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie));
if (!BC_ASSERT_TRUE(call(marie,laure))) goto end;
......@@ -1278,9 +1301,9 @@ static void eject_from_3_participants_local_conference(void) {
eject_from_3_participants_conference(marie, pauline, laure, NULL);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
static void eject_from_4_participants_conference(void) {
......@@ -1302,6 +1325,8 @@ static void eject_from_4_participants_conference(void) {
BC_ASSERT_TRUE(call(marie,pauline));
marie_call_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
if (!BC_ASSERT_PTR_NOT_NULL(marie_call_pauline)) goto end;
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie));
if (!BC_ASSERT_TRUE(call(marie,michelle)))
......@@ -1362,10 +1387,10 @@ static void eject_from_4_participants_conference(void) {
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallEnd, 3, 10000));
end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(michelle);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
bctbx_list_free(lcs);
}
......@@ -1390,10 +1415,10 @@ void simple_remote_conference(void) {
simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus, FALSE);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_conference_server_destroy(focus);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
void simple_remote_conference_shut_down_focus(void) {
......@@ -1416,10 +1441,10 @@ void simple_remote_conference_shut_down_focus(void) {
simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus, FALSE);
linphone_core_manager_destroy(marie);
linphone_conference_server_destroy(focus);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_conference_server_destroy(focus);
linphone_core_manager_destroy(marie);
}
void eject_from_3_participants_remote_conference(void) {
......@@ -1442,10 +1467,10 @@ void eject_from_3_participants_remote_conference(void) {
eject_from_3_participants_conference(marie, pauline, laure, (LinphoneCoreManager *)focus);
linphone_core_manager_destroy(marie);
linphone_conference_server_destroy(focus);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_conference_server_destroy(focus);
linphone_core_manager_destroy(marie);
}
void do_not_stop_ringing_when_declining_one_of_two_incoming_calls(void) {
......@@ -1465,6 +1490,7 @@ void do_not_stop_ringing_when_declining_one_of_two_incoming_calls(void) {
,&pauline->stat.number_of_LinphoneCallIncomingReceived
,1));
pauline_called_by_laure=linphone_core_get_current_call(pauline->lc);
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_laure)) goto end;
BC_ASSERT_EQUAL(linphone_core_get_tone_manager_stats(pauline->lc)->number_of_startRingtone, 1, int, "%d");
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(marie->lc,pauline->identity,marie_params));
......@@ -1475,6 +1501,7 @@ void do_not_stop_ringing_when_declining_one_of_two_incoming_calls(void) {
,&pauline->stat.number_of_LinphoneCallIncomingReceived
,2));
pauline_called_by_marie=linphone_core_get_current_call(marie->lc);
if (!BC_ASSERT_PTR_NOT_NULL(pauline_called_by_marie)) goto end;
BC_ASSERT_EQUAL(linphone_core_get_tone_manager_stats(pauline->lc)->number_of_startRingtone, 1, int, "%d");
linphone_call_decline(pauline_called_by_laure, LinphoneReasonDeclined);
......@@ -1492,10 +1519,10 @@ void do_not_stop_ringing_when_declining_one_of_two_incoming_calls(void) {
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallEnd,2));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallReleased,2));
BC_ASSERT_EQUAL(linphone_core_get_tone_manager_stats(pauline->lc)->number_of_stopRingtone, 2, int, "%d");
linphone_core_manager_destroy(marie);
end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(marie);
}
void no_auto_answer_on_fake_call_with_replaces_header (void) {
......
......@@ -225,6 +225,7 @@ static void recovered_call_on_network_switch_during_reinvite_1(void) {
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
outgoing_call = linphone_core_get_current_call(marie->lc);
if(!BC_ASSERT_PTR_NOT_NULL(outgoing_call)) goto end;
linphone_call_pause(outgoing_call);
linphone_core_set_network_reachable(marie->lc, FALSE);
wait_for(marie->lc, pauline->lc, &marie->stat.number_of_NetworkReachableFalse, 1);
......@@ -269,11 +270,13 @@ static void recovered_call_on_network_switch_during_reinvite_2(void) {
if (!BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1))) goto end;
incoming_call = linphone_core_get_current_call(pauline->lc);
if(!BC_ASSERT_PTR_NOT_NULL(incoming_call)) goto end;
linphone_call_accept(incoming_call);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
outgoing_call = linphone_core_get_current_call(marie->lc);
if(!BC_ASSERT_PTR_NOT_NULL(outgoing_call)) goto end;
params = linphone_core_create_call_params(marie->lc, outgoing_call);
linphone_call_params_enable_video(params, TRUE);
linphone_call_update(outgoing_call, params);
......@@ -520,12 +523,14 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh
if (caller_pause) {
pauline_call = linphone_core_get_current_call(pauline->lc);
if(!BC_ASSERT_PTR_NOT_NULL(pauline_call)) goto end;
linphone_call_pause(pauline_call);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallPausedByRemote, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallPaused, 1));
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000);
} else if (callee_pause) {
marie_call = linphone_core_get_current_call(marie->lc);
if(!BC_ASSERT_PTR_NOT_NULL(marie_call)) goto end;
linphone_call_pause(marie_call);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallPausedByRemote, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallPaused, 1));
......@@ -777,7 +782,7 @@ static test_t call_recovery_tests[] = {
TEST_ONE_TAG("Recovered call on network switch in early state 2", recovered_call_on_network_switch_in_early_state_2, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch in early state 3", recovered_call_on_network_switch_in_early_state_3, "CallRecovery"),
TEST_ONE_TAG("Recovered call on network switch in early state 4", recovered_call_on_network_switch_in_early_state_4, "CallRecovery"),
#if 0 /*enable this test when library has support for it*/
#if 0 // enable this test when library has support for it
TEST_ONE_TAG("Recovered call on socket disconnection in early state", recovered_call_on_socket_disconnection_in_early_state, "CallRecovery"),
#endif
TEST_ONE_TAG("Recovered call on network switch during re-invite 1", recovered_call_on_network_switch_during_reinvite_1, "CallRecovery"),
......
......@@ -255,8 +255,8 @@ void simple_call_base(bool_t enable_multicast_recv_side, bool_t disable_soundcar
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCoreLastCallEnded, 1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCoreLastCallEnded, 1, int, "%d");
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
if (disable_soundcard) {
ms_snd_card_manager_bypass_soundcard_detection(FALSE);
......@@ -296,8 +296,8 @@ static void simple_call_with_no_sip_transport(void){
/* restore initial transports for Marie's core in order it be able to unregister */
linphone_core_set_sip_transports(marie->lc, &oldTr);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void simple_call_with_udp(void) {
......@@ -366,8 +366,8 @@ static void automatic_call_termination(void) {
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void call_with_timed_out_bye(void) {
......@@ -2757,8 +2757,8 @@ static void _call_base_with_configfile(LinphoneMediaEncryption mode, bool_t enab
ms_warning ("not tested because %s not available", linphone_media_encryption_to_string(mode));
}
end:
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);