diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 6dd422aa9..8b5f8eff4 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -187,7 +187,7 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia ms_message("Media ip type has changed, destroying sessions context on call [%p]",call); ms_media_stream_sessions_uninit(&call->sessions[call->main_audio_stream_index]); ms_media_stream_sessions_uninit(&call->sessions[call->main_video_stream_index]); - if (call->params->realtimetext_enabled) ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]); + ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]); } linphone_call_init_media_streams (call); } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index d758164fd..7d2440601 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2947,7 +2947,7 @@ int linphone_core_restart_invite(LinphoneCore *lc, LinphoneCall *call){ linphone_call_stop_media_streams(call); ms_media_stream_sessions_uninit(&call->sessions[call->main_audio_stream_index]); ms_media_stream_sessions_uninit(&call->sessions[call->main_video_stream_index]); - if (call->params->realtimetext_enabled) ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]); + ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]); linphone_call_init_media_streams(call); return linphone_core_start_invite(lc,call, NULL); } diff --git a/coreapi/message_storage.c b/coreapi/message_storage.c index ed535367a..37a690a83 100644 --- a/coreapi/message_storage.c +++ b/coreapi/message_storage.c @@ -468,12 +468,13 @@ MSList *linphone_chat_room_get_history_range(LinphoneChatRoom *cr, int startm, i ms_free(buf); buf = buf2; } - + + begin=ortp_get_cur_time_ms(); + linphone_sql_request_message(lc->db,buf,cr); + end=ortp_get_cur_time_ms(); + if (endm+1-startm > 1) { //display message only if at least 2 messages are loaded - begin=ortp_get_cur_time_ms(); - linphone_sql_request_message(lc->db,buf,cr); - end=ortp_get_cur_time_ms(); ms_message("%s(): completed in %i ms",__FUNCTION__, (int)(end-begin)); } ms_free(buf); diff --git a/tester/message_tester.c b/tester/message_tester.c index 6d7e1960f..78aeb0b69 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -1241,8 +1241,16 @@ static void history_count(void) { messages=linphone_chat_room_get_history(chatroom,0); BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d"); BC_ASSERT_EQUAL(ms_list_size(messages), 1270, int, "%d"); + /*check the second most recent msg*/ - BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other."); + BC_ASSERT_PTR_NOT_NULL(messages); + if (messages){ + BC_ASSERT_PTR_NOT_NULL(messages->next->data); + if (messages->next->data){ + BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other."); + } + } + ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref); /*test offset+limit: retrieve the 42th latest msg only and check its content*/