mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 17:59:21 +00:00
Add tester for RTP IO mode.
This commit is contained in:
parent
2712cb4834
commit
1308b23715
2 changed files with 66 additions and 3 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 9ad7e893b80453d276db49b2b95d1c828acc84ec
|
||||
Subproject commit 224b2994c27f22129a7cf77838c10d60b823c08f
|
||||
|
|
@ -4278,7 +4278,7 @@ static void simple_mono_call_opus(void){
|
|||
simple_stereo_call("opus", 48000, 150, FALSE);
|
||||
}
|
||||
|
||||
static void call_with_fqdn_in_sdp() {
|
||||
static void call_with_fqdn_in_sdp(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
LpConfig *lp;
|
||||
|
|
@ -4306,6 +4306,68 @@ end:
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void call_with_rtp_io_mode(void) {
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
LinphonePlayer *player;
|
||||
char *hellopath = bc_tester_res("sounds/ahbahouaismaisbon.wav");
|
||||
char *recordpath = create_filepath(bc_tester_get_writable_dir_prefix(), "record-call_with_file_player", "wav");
|
||||
bool_t call_ok;
|
||||
|
||||
/* Make sure that the record file doesn't already exists, otherwise this test will append new samples to it. */
|
||||
unlink(recordpath);
|
||||
|
||||
/* The caller uses files instead of soundcard in order to avoid mixing soundcard input with file played using call's player. */
|
||||
linphone_core_use_files(marie->lc, TRUE);
|
||||
linphone_core_set_play_file(marie->lc, NULL);
|
||||
linphone_core_set_record_file(marie->lc, recordpath);
|
||||
|
||||
/* The callee uses the RTP IO mode with the PCMU codec to send back audio to the caller. */
|
||||
disable_all_audio_codecs_except_one(pauline->lc, "pcmu", -1);
|
||||
lp_config_set_int(pauline->lc->config, "sound", "rtp_io", 1);
|
||||
lp_config_set_string(pauline->lc->config, "sound", "rtp_local_addr", "127.0.0.1");
|
||||
lp_config_set_string(pauline->lc->config, "sound", "rtp_remote_addr", "127.0.0.1");
|
||||
lp_config_set_int(pauline->lc->config, "sound", "rtp_local_port", 17076);
|
||||
lp_config_set_int(pauline->lc->config, "sound", "rtp_remote_port", 17076);
|
||||
lp_config_get_string(pauline->lc->config, "sound", "rtp_map", "pcmu/8000/1");
|
||||
|
||||
BC_ASSERT_TRUE((call_ok = call(marie, pauline)));
|
||||
if (!call_ok) goto end;
|
||||
player = linphone_call_get_player(linphone_core_get_current_call(marie->lc));
|
||||
BC_ASSERT_PTR_NOT_NULL(player);
|
||||
if (player) {
|
||||
BC_ASSERT_TRUE(linphone_player_open(player, hellopath, on_eof, marie) == 0);
|
||||
BC_ASSERT_TRUE(linphone_player_start(player) == 0);
|
||||
}
|
||||
|
||||
/* This assert should be modified to be at least as long as the WAV file */
|
||||
BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_player_eof, 1, 10000));
|
||||
|
||||
linphone_core_terminate_all_calls(marie->lc);
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
|
||||
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
|
||||
|
||||
if (ms_tags_list_contains_tag(ms_factory_get_platform_tags(ms_factory_get_fallback()), "embedded")) {
|
||||
ms_warning("Cannot run audio diff on embedded platform");
|
||||
remove(recordpath);
|
||||
} else {
|
||||
double similar;
|
||||
const int threshold = 90;
|
||||
BC_ASSERT_EQUAL(ms_audio_diff(hellopath, recordpath, &similar, audio_cmp_max_shift, NULL, NULL), 0, int, "%d");
|
||||
BC_ASSERT_GREATER(100 * similar, threshold, int, "%d");
|
||||
BC_ASSERT_LOWER(100 * similar, 100, int, "%d");
|
||||
if ((threshold < (100 * similar)) && ((100 * similar) < 100)) {
|
||||
remove(recordpath);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
ms_free(recordpath);
|
||||
ms_free(hellopath);
|
||||
}
|
||||
|
||||
test_t call_tests[] = {
|
||||
{ "Early declined call", early_declined_call },
|
||||
{ "Call declined", call_declined },
|
||||
|
|
@ -4431,7 +4493,8 @@ test_t call_tests[] = {
|
|||
{ "Simple stereo call with L16", simple_stereo_call_l16 },
|
||||
{ "Simple stereo call with opus", simple_stereo_call_opus },
|
||||
{ "Simple mono call with opus", simple_mono_call_opus },
|
||||
{ "Call with FQDN in SDP", call_with_fqdn_in_sdp}
|
||||
{ "Call with FQDN in SDP", call_with_fqdn_in_sdp},
|
||||
{ "Call with RTP IO mode", call_with_rtp_io_mode }
|
||||
};
|
||||
|
||||
test_suite_t call_test_suite = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue