mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 11:38:08 +00:00
new test for opus stereo vs mono
add option to tester so that it can keep recorded files, which is useful for developing new tests
This commit is contained in:
parent
b9c3ebe9c0
commit
f336bed4e6
4 changed files with 42 additions and 16 deletions
|
|
@ -4074,7 +4074,7 @@ static void video_call_ice_params() {
|
|||
}
|
||||
#endif
|
||||
|
||||
static void simple_stereo_call(const char *codec_name, int clock_rate, int bitrate_override) {
|
||||
static void simple_stereo_call(const char *codec_name, int clock_rate, int bitrate_override, bool_t stereo) {
|
||||
int begin;
|
||||
int leaked_objects;
|
||||
LinphoneCoreManager* marie;
|
||||
|
|
@ -4096,10 +4096,10 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra
|
|||
ms_warning("%s not available, stereo with %s not tested.",codec_name, codec_name);
|
||||
goto end;
|
||||
}
|
||||
payload_type_set_recv_fmtp(pt, "stereo=1;sprop-stereo=1");
|
||||
if (stereo) payload_type_set_recv_fmtp(pt, "stereo=1;sprop-stereo=1");
|
||||
if (bitrate_override) linphone_core_set_payload_type_bitrate(marie->lc, pt, bitrate_override);
|
||||
pt = linphone_core_find_payload_type(pauline->lc, codec_name, clock_rate, 2);
|
||||
payload_type_set_recv_fmtp(pt, "stereo=1;sprop-stereo=1");
|
||||
if (stereo) payload_type_set_recv_fmtp(pt, "stereo=1;sprop-stereo=1");
|
||||
if (bitrate_override) linphone_core_set_payload_type_bitrate(pauline->lc, pt, bitrate_override);
|
||||
|
||||
disable_all_audio_codecs_except_one(marie->lc, codec_name, clock_rate);
|
||||
|
|
@ -4110,8 +4110,6 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra
|
|||
linphone_core_set_use_files(pauline->lc, TRUE);
|
||||
linphone_core_set_record_file(pauline->lc, recordpath);
|
||||
|
||||
remove(recordpath);
|
||||
|
||||
/*stereo is supported only without volume control, echo canceller...*/
|
||||
lp_config_set_string(marie->lc->config,"sound","features","NONE");
|
||||
lp_config_set_string(pauline->lc->config,"sound","features","NONE");
|
||||
|
|
@ -4123,11 +4121,19 @@ static void simple_stereo_call(const char *codec_name, int clock_rate, int bitra
|
|||
if (clock_rate!=48000) ms_warning("Similarity checking not implemented for files not having the same sampling rate");
|
||||
else{
|
||||
#if !defined(__arm__) && !defined(__arm64__) && !TARGET_IPHONE_SIMULATOR && !defined(ANDROID)
|
||||
double similar;
|
||||
const double threshold = .7f;
|
||||
BC_ASSERT_EQUAL(ms_audio_diff(stereo_file,recordpath,&similar,audio_cmp_max_shift,NULL,NULL), 0, int, "%d");
|
||||
BC_ASSERT_GREATER(similar, threshold, float, "%f");
|
||||
BC_ASSERT_LOWER(similar, 1.f, float, "%f");
|
||||
if (stereo){
|
||||
double similar;
|
||||
const double threshold = .7f;
|
||||
BC_ASSERT_EQUAL(ms_audio_diff(stereo_file,recordpath,&similar,audio_cmp_max_shift,NULL,NULL), 0, int, "%d");
|
||||
BC_ASSERT_GREATER(similar, threshold, float, "%f");
|
||||
BC_ASSERT_LOWER(similar, 1.f, float, "%f");
|
||||
}else{
|
||||
double similar;
|
||||
const double threshold = .7f;
|
||||
BC_ASSERT_EQUAL(ms_audio_diff(stereo_file,recordpath,&similar,audio_cmp_max_shift,NULL,NULL), 0, int, "%d");
|
||||
BC_ASSERT_LOWER(similar, threshold, float, "%f");
|
||||
BC_ASSERT_LOWER(similar, 1.f, float, "%f");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -4146,11 +4152,16 @@ end:
|
|||
}
|
||||
|
||||
static void simple_stereo_call_l16(void){
|
||||
simple_stereo_call("L16", 44100, 0);
|
||||
simple_stereo_call("L16", 44100, 0, TRUE);
|
||||
}
|
||||
|
||||
static void simple_stereo_call_opus(void){
|
||||
simple_stereo_call("opus", 48000, 150);
|
||||
simple_stereo_call("opus", 48000, 150, TRUE);
|
||||
}
|
||||
|
||||
static void simple_mono_call_opus(void){
|
||||
/*actually a call where input/output is made with stereo but opus transmits everything as mono*/
|
||||
simple_stereo_call("opus", 48000, 150, FALSE);
|
||||
}
|
||||
|
||||
test_t call_tests[] = {
|
||||
|
|
@ -4274,7 +4285,8 @@ test_t call_tests[] = {
|
|||
{ "Call with transport change after released", call_with_transport_change_after_released },
|
||||
{ "Unsuccessful call with transport change after released",unsucessfull_call_with_transport_change_after_released},
|
||||
{ "Simple stereo call with L16", simple_stereo_call_l16 },
|
||||
{ "Simple stereo call with opus", simple_stereo_call_opus }
|
||||
{ "Simple stereo call with opus", simple_stereo_call_opus },
|
||||
{ "Simple mono call with opus", simple_mono_call_opus }
|
||||
};
|
||||
|
||||
test_suite_t call_test_suite = {
|
||||
|
|
|
|||
|
|
@ -175,7 +175,8 @@ static const char* liblinphone_helper =
|
|||
"\t\t\t--config <config path>\n"
|
||||
"\t\t\t--domain <test sip domain>\n"
|
||||
"\t\t\t--auth-domain <test auth domain>\n"
|
||||
"\t\t\t--dns-hosts </etc/hosts -like file to used to override DNS names (default: tester_hosts)>\n";
|
||||
"\t\t\t--dns-hosts </etc/hosts -like file to used to override DNS names (default: tester_hosts)>\n"
|
||||
"\t\t\t--keep-recorded-files\n";
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
int main (int argc, char *argv[])
|
||||
|
|
@ -220,6 +221,8 @@ int main (int argc, char *argv[])
|
|||
}else if (strcmp(argv[i],"--dns-hosts")==0){
|
||||
CHECK_ARG("--dns-hosts", ++i, argc);
|
||||
userhostsfile=argv[i];
|
||||
} else if (strcmp(argv[i],"--keep-recorded-files")==0){
|
||||
liblinphone_tester_keep_recorded_files(TRUE);
|
||||
} else {
|
||||
int ret = bc_tester_parse_args(argc, argv, i);
|
||||
if (ret>0) {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,12 @@ extern int liblinphone_tester_ipv6_available(void);
|
|||
*/
|
||||
extern void liblinphone_tester_keep_accounts( int keep );
|
||||
|
||||
/**
|
||||
* @brief Tells the test whether to not remove recorded audio/video files after the tests.
|
||||
* @details By default recorded files are erased after the test, unless the test is failed.
|
||||
**/
|
||||
void liblinphone_tester_keep_recorded_files(int keep);
|
||||
|
||||
/**
|
||||
* @brief Clears the created accounts during the testing session.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
static bool_t liblinphone_tester_ipv6_enabled=FALSE;
|
||||
static int liblinphone_tester_keep_accounts_flag = 0;
|
||||
static int liblinphone_tester_keep_record_files = FALSE;
|
||||
static int manager_count = 0;
|
||||
|
||||
const char* test_domain="sipopen.example.org";
|
||||
|
|
@ -40,7 +41,7 @@ const char* test_password="secret";
|
|||
const char* test_route="sip2.linphone.org";
|
||||
const char *userhostsfile = "tester_hosts";
|
||||
|
||||
static void network_reachable(LinphoneCore *lc, bool_t reachable) {
|
||||
static void network_reachable(LinphoneCore *lc, bool_t reachable) {
|
||||
stats* counters;
|
||||
ms_message("Network reachable [%s]",reachable?"TRUE":"FALSE");
|
||||
counters = get_stats(lc);
|
||||
|
|
@ -349,7 +350,7 @@ void linphone_core_manager_stop(LinphoneCoreManager *mgr){
|
|||
void linphone_core_manager_destroy(LinphoneCoreManager* mgr) {
|
||||
if (mgr->lc){
|
||||
const char *record_file=linphone_core_get_record_file(mgr->lc);
|
||||
if (record_file){
|
||||
if (!liblinphone_tester_keep_record_files && record_file){
|
||||
if ((CU_get_number_of_failures()-mgr->number_of_cunit_error_at_creation)>0) {
|
||||
ms_message ("Test has failed, keeping recorded file [%s]",record_file);
|
||||
} else {
|
||||
|
|
@ -387,6 +388,10 @@ void liblinphone_tester_keep_accounts( int keep ){
|
|||
liblinphone_tester_keep_accounts_flag = keep;
|
||||
}
|
||||
|
||||
void liblinphone_tester_keep_recorded_files(int keep){
|
||||
liblinphone_tester_keep_record_files = keep;
|
||||
}
|
||||
|
||||
void liblinphone_tester_clear_accounts(void){
|
||||
account_manager_destroy();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue