Commit 85de7962 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Updated ms2 to show textstream RTP stats + added test for rtt copy/paste and rtt call with ice

parent 6d4e1457
mediastreamer2 @ 84c1fa34
Subproject commit af36a13d36b8e63d25983a8f786cc1edd02498e5
Subproject commit 84c1fa34495c7582edc280b1788fbb2788e6e8e6
......@@ -989,88 +989,6 @@ static void call_with_no_sdp_ack_without_sdp(void){
linphone_core_manager_destroy(pauline);
}
static bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state) {
LinphoneCall *c1,*c2;
bool_t audio_success=FALSE;
bool_t video_success=FALSE;
bool_t text_success=FALSE;
bool_t video_enabled, realtime_text_enabled;
MSTimeSpec ts;
c1=linphone_core_get_current_call(caller->lc);
c2=linphone_core_get_current_call(callee->lc);
BC_ASSERT_PTR_NOT_NULL(c1);
BC_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return FALSE;
linphone_call_ref(c1);
linphone_call_ref(c2);
BC_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2)), int, "%d");
BC_ASSERT_EQUAL(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c1)),linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c2)), int, "%d");
video_enabled=linphone_call_params_video_enabled(linphone_call_get_current_params(c1));
realtime_text_enabled=linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c1));
liblinphone_tester_clock_start(&ts);
do{
if ((c1 != NULL) && (c2 != NULL)) {
if (linphone_call_get_audio_stats(c1)->ice_state==state &&
linphone_call_get_audio_stats(c2)->ice_state==state ){
audio_success=TRUE;
break;
}
linphone_core_iterate(caller->lc);
linphone_core_iterate(callee->lc);
}
ms_usleep(20000);
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
if (video_enabled){
liblinphone_tester_clock_start(&ts);
do{
if ((c1 != NULL) && (c2 != NULL)) {
if (linphone_call_get_video_stats(c1)->ice_state==state &&
linphone_call_get_video_stats(c2)->ice_state==state ){
video_success=TRUE;
break;
}
linphone_core_iterate(caller->lc);
linphone_core_iterate(callee->lc);
}
ms_usleep(20000);
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
}
if (realtime_text_enabled){
liblinphone_tester_clock_start(&ts);
do{
if ((c1 != NULL) && (c2 != NULL)) {
if (linphone_call_get_text_stats(c1)->ice_state==state &&
linphone_call_get_text_stats(c2)->ice_state==state ){
text_success=TRUE;
break;
}
linphone_core_iterate(caller->lc);
linphone_core_iterate(callee->lc);
}
ms_usleep(20000);
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
}
/*make sure encryption mode are preserved*/
if (c1) {
const LinphoneCallParams* call_param = linphone_call_get_current_params(c1);
BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d");
}
if (c2) {
const LinphoneCallParams* call_param = linphone_call_get_current_params(c2);
BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(callee->lc), int, "%d");
}
linphone_call_unref(c1);
linphone_call_unref(c2);
return video_enabled ? (realtime_text_enabled ? text_success && audio_success && video_success : audio_success && video_success) : realtime_text_enabled ? text_success && audio_success : audio_success;
}
static void check_nb_media_starts(LinphoneCoreManager *caller, LinphoneCoreManager *callee, unsigned int caller_nb_media_starts, unsigned int callee_nb_media_starts) {
LinphoneCall *c1 = linphone_core_get_current_call(caller->lc);
LinphoneCall *c2 = linphone_core_get_current_call(callee->lc);
......
......@@ -235,4 +235,85 @@ int main (int argc, char *argv[])
liblinphone_tester_uninit();
return ret;
}
bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state) {
LinphoneCall *c1,*c2;
bool_t audio_success=FALSE;
bool_t video_success=FALSE;
bool_t text_success=FALSE;
bool_t video_enabled, realtime_text_enabled;
MSTimeSpec ts;
c1=linphone_core_get_current_call(caller->lc);
c2=linphone_core_get_current_call(callee->lc);
BC_ASSERT_PTR_NOT_NULL(c1);
BC_ASSERT_PTR_NOT_NULL(c2);
if (!c1 || !c2) return FALSE;
linphone_call_ref(c1);
linphone_call_ref(c2);
BC_ASSERT_EQUAL(linphone_call_params_video_enabled(linphone_call_get_current_params(c1)),linphone_call_params_video_enabled(linphone_call_get_current_params(c2)), int, "%d");
BC_ASSERT_EQUAL(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c1)),linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c2)), int, "%d");
video_enabled=linphone_call_params_video_enabled(linphone_call_get_current_params(c1));
realtime_text_enabled=linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(c1));
liblinphone_tester_clock_start(&ts);
do{
if ((c1 != NULL) && (c2 != NULL)) {
if (linphone_call_get_audio_stats(c1)->ice_state==state &&
linphone_call_get_audio_stats(c2)->ice_state==state ){
audio_success=TRUE;
break;
}
linphone_core_iterate(caller->lc);
linphone_core_iterate(callee->lc);
}
ms_usleep(20000);
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
if (video_enabled){
liblinphone_tester_clock_start(&ts);
do{
if ((c1 != NULL) && (c2 != NULL)) {
if (linphone_call_get_video_stats(c1)->ice_state==state &&
linphone_call_get_video_stats(c2)->ice_state==state ){
video_success=TRUE;
break;
}
linphone_core_iterate(caller->lc);
linphone_core_iterate(callee->lc);
}
ms_usleep(20000);
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
}
if (realtime_text_enabled){
liblinphone_tester_clock_start(&ts);
do{
if ((c1 != NULL) && (c2 != NULL)) {
if (linphone_call_get_text_stats(c1)->ice_state==state &&
linphone_call_get_text_stats(c2)->ice_state==state ){
text_success=TRUE;
break;
}
linphone_core_iterate(caller->lc);
linphone_core_iterate(callee->lc);
}
ms_usleep(20000);
}while(!liblinphone_tester_clock_elapsed(&ts,10000));
}
/*make sure encryption mode are preserved*/
if (c1) {
const LinphoneCallParams* call_param = linphone_call_get_current_params(c1);
BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(caller->lc), int, "%d");
}
if (c2) {
const LinphoneCallParams* call_param = linphone_call_get_current_params(c2);
BC_ASSERT_EQUAL(linphone_call_params_get_media_encryption(call_param),linphone_core_get_media_encryption(callee->lc), int, "%d");
}
linphone_call_unref(c1);
linphone_call_unref(c2);
return video_enabled ? (realtime_text_enabled ? text_success && audio_success && video_success : audio_success && video_success) : realtime_text_enabled ? text_success && audio_success : audio_success;
}
#endif
......@@ -347,6 +347,7 @@ void liblinphone_tester_after_each(void);
void liblinphone_tester_init(void(*ftester_printf)(int level, const char *fmt, va_list args));
void liblinphone_tester_uninit(void);
int liblinphone_tester_set_log_file(const char *filename);
bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state);
extern const char *liblinphone_tester_mire_id;
......
......@@ -1289,7 +1289,7 @@ static void file_transfer_io_error_after_destroying_chatroom(void) {
file_transfer_io_error_base("https://www.linphone.org:444/lft.php", TRUE);
}
static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, bool_t mess_with_marie_payload_number, bool_t mess_with_pauline_payload_number) {
static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, bool_t mess_with_marie_payload_number, bool_t mess_with_pauline_payload_number, bool_t ice_enabled) {
LinphoneChatRoom *pauline_chat_room;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
......@@ -1316,6 +1316,11 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
}
}
if (ice_enabled) {
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
}
if (srtp_enabled) {
BC_ASSERT_TRUE(linphone_core_media_encryption_supported(marie->lc, LinphoneMediaEncryptionSRTP));
linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP);
......@@ -1364,6 +1369,10 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
BC_ASSERT_FALSE(marie->stat.number_of_LinphoneCallEnd > 0);
BC_ASSERT_FALSE(pauline->stat.number_of_LinphoneCallEnd > 0);
}
if (ice_enabled) {
BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection));
}
end_call(marie, pauline);
}
......@@ -1373,7 +1382,7 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo
}
static void real_time_text_message(void) {
real_time_text(TRUE, FALSE, FALSE, FALSE);
real_time_text(TRUE, FALSE, FALSE, FALSE, FALSE);
}
static void real_time_text_conversation(void) {
......@@ -1476,11 +1485,15 @@ static void real_time_text_conversation(void) {
}
static void real_time_text_without_audio(void) {
real_time_text(FALSE, FALSE, FALSE, FALSE);
real_time_text(FALSE, FALSE, FALSE, FALSE, FALSE);
}
static void real_time_text_srtp(void) {
real_time_text(TRUE, TRUE, FALSE, FALSE);
real_time_text(TRUE, TRUE, FALSE, FALSE, FALSE);
}
static void real_time_text_ice(void) {
real_time_text(TRUE, FALSE, FALSE, FALSE, TRUE);
}
static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_lf) {
......@@ -1530,15 +1543,15 @@ static void real_time_text_message_compat(bool_t end_with_crlf, bool_t end_with_
linphone_core_manager_destroy(pauline);
}
static void real_time_text_message_compat_crlf() {
static void real_time_text_message_compat_crlf(void) {
real_time_text_message_compat(TRUE, FALSE);
}
static void real_time_text_message_compat_lf() {
static void real_time_text_message_compat_lf(void) {
real_time_text_message_compat(FALSE, TRUE);
}
static void real_time_text_message_accented_chars() {
static void real_time_text_message_accented_chars(void) {
LinphoneChatRoom *pauline_chat_room;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
......@@ -1588,12 +1601,57 @@ static void real_time_text_message_accented_chars() {
linphone_core_manager_destroy(pauline);
}
static void real_time_text_message_different_text_codecs_payload_numbers_sender_side() {
real_time_text(FALSE, FALSE, TRUE, FALSE);
static void real_time_text_message_different_text_codecs_payload_numbers_sender_side(void) {
real_time_text(FALSE, FALSE, TRUE, FALSE, FALSE);
}
static void real_time_text_message_different_text_codecs_payload_numbers_receiver_side() {
real_time_text(FALSE, FALSE, FALSE, TRUE);
static void real_time_text_message_different_text_codecs_payload_numbers_receiver_side(void) {
real_time_text(FALSE, FALSE, FALSE, TRUE, FALSE);
}
static void real_time_text_copy_paste(void) {
LinphoneChatRoom *pauline_chat_room;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCallParams *marie_params = NULL;
LinphoneCall *pauline_call, *marie_call;
marie_params = linphone_core_create_call_params(marie->lc, NULL);
linphone_call_params_enable_realtime_text(marie_params,TRUE);
BC_ASSERT_TRUE(call_with_caller_params(marie, pauline, marie_params));
pauline_call = linphone_core_get_current_call(pauline->lc);
marie_call = linphone_core_get_current_call(marie->lc);
if (pauline_call) {
BC_ASSERT_TRUE(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(pauline_call)));
pauline_chat_room = linphone_call_get_chat_room(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_chat_room);
if (pauline_chat_room) {
const char* message = "Lorem Ipsum Belledonnum Communicatum";
int i;
LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL);
LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(marie_call);
for (i = 1; i <= strlen(message); i++) {
linphone_chat_message_put_char(rtt_message, message[i-1]);
if (i % 4 == 0) {
int j;
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i, 1000));
for (j = 4; j > 0; j--) {
BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message[i-j], char, "%c");
}
}
}
linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message);
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
}
end_call(marie, pauline);
}
linphone_call_params_destroy(marie_params);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
void file_transfer_with_http_proxy(void) {
......@@ -1648,11 +1706,13 @@ test_t message_tests[] = {
{"Real Time Text conversation", real_time_text_conversation},
{"Real Time Text without audio", real_time_text_without_audio},
{"Real Time Text with srtp", real_time_text_srtp},
{"Real Time Text with ice", real_time_text_ice},
{"Real Time Text message compatibility crlf", real_time_text_message_compat_crlf},
{"Real Time Text message compatibility lf", real_time_text_message_compat_lf},
{"Real Time Text message with accented characters", real_time_text_message_accented_chars},
{"Real Time Text offer answer with different payload numbers (sender side)", real_time_text_message_different_text_codecs_payload_numbers_sender_side},
{"Real Time Text offer answer with different payload numbers (receiver side)", real_time_text_message_different_text_codecs_payload_numbers_receiver_side},
{"Real Time Text copy paste", real_time_text_copy_paste},
};
test_suite_t message_test_suite = {
......
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