tester: fix failing tests due to bv16

parent c7a833b9
......@@ -39,7 +39,7 @@ static int tester_before_all(void) {
_factory = ms_factory_new();
ms_factory_init_voip(_factory);
ms_factory_init_plugins(_factory);
//ms_filter_enable_statistics(TRUE);
ms_factory_enable_statistics(_factory, TRUE);
ortp_init();
......@@ -155,8 +155,7 @@ static void basic_audio_stream_base_2( const char* marielle_local_ip
reset_stats(&marielle_stats);
reset_stats(&margaux_stats);
//rtp_profile_set_payload (profile,0,&payload_type_pcmu8000);
rtp_profile_set_payload (profile,127,&payload_type_bv16);
rtp_profile_set_payload (profile,0,&payload_type_pcmu8000);
BC_ASSERT_EQUAL(audio_stream_start_full(margaux
, profile
......
......@@ -54,10 +54,10 @@ static void dtmfgen_tonedet(void) {
unsigned int filter_mask = FILTER_MASK_VOIDSOURCE | FILTER_MASK_DTMFGEN | FILTER_MASK_TONEDET | FILTER_MASK_VOIDSINK;
bool_t send_silence = TRUE;
// ms_filter_reset_statistics();
ms_factory_reset_statistics(factory);
ms_tester_create_ticker();
ms_tester_create_filters(filter_mask, factory);
ms_filter_add_notify_callback(ms_tester_tonedet, (MSFilterNotifyFunc)tone_detected_cb, NULL,TRUE);
......@@ -93,11 +93,11 @@ static void dtmfgen_enc_dec_tonedet(char *mime, int sample_rate, int nchannels,
bool_t send_silence = TRUE;
MSSndCardManager *scm = ms_factory_get_snd_card_manager(factory);
ms_factory_reset_statistics(scm->factory);
if (!fileplay){
filter_mask= FILTER_MASK_VOIDSOURCE | FILTER_MASK_DTMFGEN | FILTER_MASK_ENCODER
| FILTER_MASK_DECODER | FILTER_MASK_TONEDET | FILTER_MASK_VOIDSINK;
}else{
filter_mask = FILTER_MASK_VOIDSOURCE | FILTER_MASK_DTMFGEN | FILTER_MASK_ENCODER
| FILTER_MASK_DECODER | FILTER_MASK_TONEDET | FILTER_MASK_SOUNDWRITE;
......@@ -121,16 +121,16 @@ static void dtmfgen_enc_dec_tonedet(char *mime, int sample_rate, int nchannels,
ms_filter_call_method(ms_tester_decoder, MS_FILTER_SET_NCHANNELS, &nchannels);
ms_filter_call_method(ms_tester_tonedet, MS_FILTER_SET_SAMPLE_RATE, &sample_rate);
ms_filter_call_method(ms_tester_tonedet, MS_FILTER_SET_NCHANNELS, &nchannels);
if (!fileplay){
ms_filter_call_method(ms_tester_voidsink, MS_FILTER_SET_SAMPLE_RATE, &sample_rate);
ms_filter_call_method(ms_tester_voidsink, MS_FILTER_SET_NCHANNELS, &nchannels);
}else{
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_SET_SAMPLE_RATE, &sample_rate);
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_SET_NCHANNELS, &nchannels);
}
ms_filter_add_notify_callback(ms_tester_tonedet, (MSFilterNotifyFunc)tone_detected_cb, NULL,TRUE);
ms_connection_helper_start(&h);
ms_connection_helper_link(&h, ms_tester_voidsource, -1, 0);
......@@ -143,12 +143,12 @@ static void dtmfgen_enc_dec_tonedet(char *mime, int sample_rate, int nchannels,
}else{
ms_connection_helper_link(&h, ms_tester_soundwrite, 0, -1);
}
ms_ticker_attach(ms_tester_ticker, ms_tester_voidsource);
ms_tester_tone_generation_and_detection_loop();
ms_ticker_detach(ms_tester_ticker, ms_tester_voidsource);
ms_connection_helper_start(&h);
ms_connection_helper_unlink(&h, ms_tester_voidsource, -1, 0);
......@@ -173,25 +173,25 @@ static void dtmfgen_enc_dec_tonedet(char *mime, int sample_rate, int nchannels,
static void dtmfgen_enc_dec_tonedet_filerec_fileplay(char *mime, int sample_rate, int nchannels) {
MSConnectionHelper h;
unsigned int filter_mask = FILTER_MASK_VOIDSOURCE | FILTER_MASK_DTMFGEN | FILTER_MASK_ENCODER
| FILTER_MASK_DECODER | FILTER_MASK_TONEDET | FILTER_MASK_VOIDSINK | FILTER_MASK_SOUNDREAD | FILTER_MASK_FILEREC | FILTER_MASK_FILEPLAY | FILTER_MASK_SOUNDWRITE;
bool_t send_silence = TRUE;
int capture_sample_rate = 8000;
int playback_sample_rate = 8000;
int capture_nchannels = 1;
int playback_nchannels = 1;
char *writable_filename = bc_tester_file(SOUNDREAD_FILE_NAME);
MSSndCardManager *scm = ms_factory_get_snd_card_manager(factory);
ms_factory_reset_statistics(scm->factory);
//ms_filter_reset_statistics();
ms_tester_create_ticker();
ms_tester_codec_mime = mime;
ms_tester_create_filters(filter_mask, scm->factory);
// Write audio capture to a file
ms_filter_call_method(ms_tester_soundread, MS_FILTER_GET_SAMPLE_RATE, &capture_sample_rate);
ms_filter_call_method(ms_tester_soundread, MS_FILTER_GET_NCHANNELS, &capture_nchannels);
......@@ -205,7 +205,7 @@ static void dtmfgen_enc_dec_tonedet_filerec_fileplay(char *mime, int sample_rate
ms_connection_helper_link(&h, ms_tester_filerec, 0, -1);
ms_ticker_attach(ms_tester_ticker, ms_tester_soundread);
/* set sample rate and channel number to all filters (might need to check the return value to insert a resampler if needed?) */
ms_filter_call_method(ms_tester_voidsource, MS_FILTER_SET_SAMPLE_RATE, &sample_rate);
ms_filter_call_method(ms_tester_voidsource, MS_FILTER_SET_NCHANNELS, &nchannels);
......@@ -220,8 +220,8 @@ static void dtmfgen_enc_dec_tonedet_filerec_fileplay(char *mime, int sample_rate
ms_filter_call_method(ms_tester_tonedet, MS_FILTER_SET_NCHANNELS, &nchannels);
ms_filter_call_method(ms_tester_voidsink, MS_FILTER_SET_SAMPLE_RATE, &sample_rate);
ms_filter_call_method(ms_tester_voidsink, MS_FILTER_SET_NCHANNELS, &nchannels);
ms_filter_add_notify_callback(ms_tester_tonedet, (MSFilterNotifyFunc)tone_detected_cb, NULL,TRUE);
ms_connection_helper_start(&h);
ms_connection_helper_link(&h, ms_tester_voidsource, -1, 0);
......@@ -231,15 +231,15 @@ static void dtmfgen_enc_dec_tonedet_filerec_fileplay(char *mime, int sample_rate
ms_connection_helper_link(&h, ms_tester_tonedet, 0, 0);
ms_connection_helper_link(&h, ms_tester_voidsink, 0, -1);
ms_ticker_attach(ms_tester_ticker, ms_tester_voidsource);
ms_tester_tone_generation_and_detection_loop();
ms_filter_call_method_noarg(ms_tester_filerec, MS_FILE_REC_CLOSE);
ms_ticker_detach(ms_tester_ticker, ms_tester_soundread);
ms_connection_helper_start(&h);
ms_connection_helper_unlink(&h, ms_tester_soundread, -1, 0);
ms_connection_helper_unlink(&h, ms_tester_filerec, 0, -1);
// Read the previous file and play it
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_GET_SAMPLE_RATE, &playback_sample_rate);
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_GET_NCHANNELS, &playback_nchannels);
......@@ -270,16 +270,18 @@ static void dtmfgen_enc_dec_tonedet_filerec_fileplay(char *mime, int sample_rate
static void dtmfgen_enc_dec_tonedet_pcmu(void) {
dtmfgen_enc_dec_tonedet("pcmu", 8000, 1, FALSE);
if (ms_factory_codec_supported(factory, "pcmu")) {
dtmfgen_enc_dec_tonedet("pcmu", 8000, 1, FALSE);
}
}
static void dtmfgen_enc_dec_tonedet_bv16(void) {
dtmfgen_enc_dec_tonedet("bv16", 8000, 1, TRUE);
if (ms_factory_codec_supported(factory, "bv16")) {
dtmfgen_enc_dec_tonedet("bv16", 8000, 1, TRUE);
}
}
static void dtmfgen_enc_dec_tonedet_isac(void) {
bool_t supported = ms_factory_codec_supported(factory, "iSAC");
// bool_t supported = ms_filter_codec_supported("iSAC");
if( supported ) {
if (ms_factory_codec_supported(factory, "iSAC")) {
dtmfgen_enc_dec_tonedet("iSAC", 16000, 1,FALSE);
}
}
......@@ -298,7 +300,7 @@ static void dtmfgen_enc_rtp_dec_tonedet(void) {
bool_t send_silence = TRUE;
MSSndCardManager *scm = ms_factory_get_snd_card_manager(factory);
ms_factory_reset_statistics(factory);
//ms_filter_reset_statistics();
ms_tester_create_ticker();
ms_tester_codec_mime = "pcmu";
......@@ -353,7 +355,7 @@ static void dtmfgen_filerec_fileplay_tonedet(void) {
bool_t send_silence = TRUE;
char* recorded_file = bc_tester_file(DTMFGEN_FILE_NAME);
ms_factory_reset_statistics(factory);
ms_tester_create_ticker();
ms_tester_create_filters(filter_mask, factory);
......
......@@ -280,102 +280,104 @@ static void soundread_soundwrite(void) {
}
static void fileplay_bv16enc_bv16dec_soundwrite(void) {
MSConnectionHelper h;
MSFilter *read_resampler = NULL, *write_resampler = NULL;
bool_t need_read_resampler = FALSE, need_write_resampler = TRUE;
unsigned int filter_mask = FILTER_MASK_FILEPLAY | FILTER_MASK_ENCODER | FILTER_MASK_DECODER | FILTER_MASK_SOUNDWRITE;
int sample_rate = 8000;
int nchannels = 1;
int done = FALSE;
const char* filepath = ARPEGGIO_8000_MONO_FILE_NAME;
char* filename = bc_tester_res(filepath);
int elapsed = 0;
ms_filter_reset_statistics();
ms_tester_create_ticker();
ms_tester_codec_mime = "bv16";
ms_tester_create_filters(filter_mask, ms_factory_get_fallback());
//file
ms_filter_add_notify_callback(ms_tester_fileplay, fileplay_eof, &done,TRUE);
ms_filter_call_method_noarg(ms_tester_fileplay, MS_FILE_PLAYER_CLOSE);
ms_filter_call_method(ms_tester_fileplay, MS_FILE_PLAYER_OPEN, (void *)filename);
ms_filter_call_method_noarg(ms_tester_fileplay, MS_FILE_PLAYER_START);
ms_filter_call_method(ms_tester_fileplay, MS_FILTER_GET_SAMPLE_RATE, &sample_rate);
ms_filter_call_method(ms_tester_fileplay, MS_FILTER_GET_NCHANNELS, &nchannels);
ms_filter_call_method(ms_tester_encoder, MS_FILTER_GET_BITRATE, &sample_rate);
ms_filter_call_method(ms_tester_decoder, MS_FILTER_SET_BITRATE, &sample_rate);
if (need_read_resampler == TRUE) {
ms_tester_create_filters(FILTER_MASK_RESAMPLER, ms_factory_get_fallback());
configure_resampler(ms_tester_resampler, ms_tester_fileplay, ms_tester_encoder);
}
ms_connection_helper_start(&h);
ms_connection_helper_link(&h, ms_tester_fileplay, -1, 0);
if (need_read_resampler == TRUE) {
ms_connection_helper_link(&h, ms_tester_resampler, 0, 0);
if (ms_factory_codec_supported(ms_factory_get_fallback(), "bv16")) {
MSConnectionHelper h;
MSFilter *read_resampler = NULL, *write_resampler = NULL;
bool_t need_read_resampler = FALSE, need_write_resampler = TRUE;
unsigned int filter_mask = FILTER_MASK_FILEPLAY | FILTER_MASK_ENCODER | FILTER_MASK_DECODER | FILTER_MASK_SOUNDWRITE;
int sample_rate = 8000;
int nchannels = 1;
int done = FALSE;
const char* filepath = ARPEGGIO_8000_MONO_FILE_NAME;
char* filename = bc_tester_res(filepath);
int elapsed = 0;
ms_filter_reset_statistics();
ms_tester_create_ticker();
ms_tester_codec_mime = "bv16";
ms_tester_create_filters(filter_mask, ms_factory_get_fallback());
//file
ms_filter_add_notify_callback(ms_tester_fileplay, fileplay_eof, &done,TRUE);
ms_filter_call_method_noarg(ms_tester_fileplay, MS_FILE_PLAYER_CLOSE);
ms_filter_call_method(ms_tester_fileplay, MS_FILE_PLAYER_OPEN, (void *)filename);
ms_filter_call_method_noarg(ms_tester_fileplay, MS_FILE_PLAYER_START);
ms_filter_call_method(ms_tester_fileplay, MS_FILTER_GET_SAMPLE_RATE, &sample_rate);
ms_filter_call_method(ms_tester_fileplay, MS_FILTER_GET_NCHANNELS, &nchannels);
ms_filter_call_method(ms_tester_encoder, MS_FILTER_GET_BITRATE, &sample_rate);
ms_filter_call_method(ms_tester_decoder, MS_FILTER_SET_BITRATE, &sample_rate);
if (need_read_resampler == TRUE) {
ms_tester_create_filters(FILTER_MASK_RESAMPLER, ms_factory_get_fallback());
configure_resampler(ms_tester_resampler, ms_tester_fileplay, ms_tester_encoder);
}
ms_connection_helper_start(&h);
ms_connection_helper_link(&h, ms_tester_fileplay, -1, 0);
if (need_read_resampler == TRUE) {
ms_connection_helper_link(&h, ms_tester_resampler, 0, 0);
}
if (ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_SET_BITRATE, &sample_rate) != 0) {
int soundwrite_sample_rate = 8000;
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_GET_BITRATE, &soundwrite_sample_rate);
if (sample_rate != soundwrite_sample_rate) need_write_resampler = TRUE;
}
if (ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_SET_NCHANNELS, &nchannels) != 0) {
int soundwrite_nchannels = 1;
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_GET_NCHANNELS, &soundwrite_nchannels);
if (nchannels != soundwrite_nchannels) need_write_resampler = TRUE;
}
if (need_write_resampler == TRUE) {
ms_tester_create_filter(&write_resampler, MS_RESAMPLE_ID, ms_factory_get_fallback());
configure_resampler(write_resampler, ms_tester_decoder, ms_tester_soundwrite);
}
ms_connection_helper_link(&h, ms_tester_encoder, 0, 0);
ms_connection_helper_link(&h, ms_tester_decoder, 0, 0);
if (need_write_resampler == TRUE) {
ms_connection_helper_link(&h, write_resampler, 0, 0);
}
ms_connection_helper_link(&h, ms_tester_soundwrite, 0, -1);
ms_ticker_attach(ms_tester_ticker, ms_tester_fileplay);
while (done != TRUE && elapsed < 6000) {
elapsed++;
ms_usleep(10000);
}
ms_filter_call_method_noarg(ms_tester_fileplay, MS_FILE_PLAYER_CLOSE);
ms_ticker_detach(ms_tester_ticker, ms_tester_fileplay);
ms_connection_helper_start(&h);
ms_connection_helper_unlink(&h, ms_tester_fileplay, -1, 0);
if (need_read_resampler == TRUE) {
ms_connection_helper_unlink(&h, ms_tester_resampler, 0, 0);
}
ms_connection_helper_unlink(&h, ms_tester_encoder, 0, 0);
ms_connection_helper_unlink(&h, ms_tester_decoder, 0, 0);
if (need_write_resampler == TRUE) {
ms_connection_helper_unlink(&h, write_resampler, 0, 0);
}
ms_connection_helper_unlink(&h, ms_tester_soundwrite, 0, -1);
if (need_read_resampler == TRUE) {
ms_tester_destroy_filter(&read_resampler);
}
if (need_write_resampler == TRUE) {
ms_tester_destroy_filter(&write_resampler);
}
ms_filter_log_statistics();
ms_tester_destroy_filters(filter_mask);
ms_tester_destroy_ticker();
free(filename);
}
if (ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_SET_BITRATE, &sample_rate) != 0) {
int soundwrite_sample_rate = 8000;
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_GET_BITRATE, &soundwrite_sample_rate);
if (sample_rate != soundwrite_sample_rate) need_write_resampler = TRUE;
}
if (ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_SET_NCHANNELS, &nchannels) != 0) {
int soundwrite_nchannels = 1;
ms_filter_call_method(ms_tester_soundwrite, MS_FILTER_GET_NCHANNELS, &soundwrite_nchannels);
if (nchannels != soundwrite_nchannels) need_write_resampler = TRUE;
}
if (need_write_resampler == TRUE) {
ms_tester_create_filter(&write_resampler, MS_RESAMPLE_ID, ms_factory_get_fallback());
configure_resampler(write_resampler, ms_tester_decoder, ms_tester_soundwrite);
}
ms_connection_helper_link(&h, ms_tester_encoder, 0, 0);
ms_connection_helper_link(&h, ms_tester_decoder, 0, 0);
if (need_write_resampler == TRUE) {
ms_connection_helper_link(&h, write_resampler, 0, 0);
}
ms_connection_helper_link(&h, ms_tester_soundwrite, 0, -1);
ms_ticker_attach(ms_tester_ticker, ms_tester_fileplay);
while (done != TRUE && elapsed < 6000) {
elapsed++;
ms_usleep(10000);
}
ms_filter_call_method_noarg(ms_tester_fileplay, MS_FILE_PLAYER_CLOSE);
ms_ticker_detach(ms_tester_ticker, ms_tester_fileplay);
ms_connection_helper_start(&h);
ms_connection_helper_unlink(&h, ms_tester_fileplay, -1, 0);
if (need_read_resampler == TRUE) {
ms_connection_helper_unlink(&h, ms_tester_resampler, 0, 0);
}
ms_connection_helper_unlink(&h, ms_tester_encoder, 0, 0);
ms_connection_helper_unlink(&h, ms_tester_decoder, 0, 0);
if (need_write_resampler == TRUE) {
ms_connection_helper_unlink(&h, write_resampler, 0, 0);
}
ms_connection_helper_unlink(&h, ms_tester_soundwrite, 0, -1);
if (need_read_resampler == TRUE) {
ms_tester_destroy_filter(&read_resampler);
}
if (need_write_resampler == TRUE) {
ms_tester_destroy_filter(&write_resampler);
}
ms_filter_log_statistics();
ms_tester_destroy_filters(filter_mask);
ms_tester_destroy_ticker();
free(filename);
}
static void soundread_speexenc_speexdec_soundwrite(void) {
......
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