Skip to content

Commit

Permalink
test: call - snd card aufmt vs codec aufmt
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed May 29, 2024
1 parent 5d7356d commit 0325abf
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions test/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,22 +1799,26 @@ int test_call_progress(void)
}


static int test_media_base(enum audio_mode txmode, enum aufmt fmt)
static int test_media_base(enum audio_mode txmode,
enum aufmt sndfmt, enum aufmt acfmt)
{
struct fixture fix, *f = &fix;
struct cancel_rule *cr;
struct auplay *auplay = NULL;
int err = 0;

fixture_init_prm(f, ";ptime=1;audio_player=mock-auplay,a");
fixture_init_prm(f, ";ptime=5;audio_player=mock-auplay,a");
mem_deref(f->b.ua);
err = ua_alloc(&f->b.ua, "B <sip:b@127.0.0.1>"
";regint=0;ptime=1;audio_player=mock-auplay,b");
";regint=0;ptime=5;audio_player=mock-auplay,b");
TEST_ERR(err);

conf_config()->audio.txmode = txmode;
conf_config()->audio.src_fmt = fmt;
conf_config()->audio.play_fmt = fmt;
conf_config()->audio.src_fmt = sndfmt;
conf_config()->audio.channels_src = 1;
conf_config()->audio.play_fmt = sndfmt;
conf_config()->audio.enc_fmt = acfmt;
conf_config()->audio.dec_fmt = acfmt;
conf_config()->avt.rtp_stats = true;

cancel_rule_new(UA_EVENT_CUSTOM, f->a.ua, 0, 0, 1);
Expand All @@ -1839,7 +1843,7 @@ static int test_media_base(enum audio_mode txmode, enum aufmt fmt)
TEST_ERR(err);

/* run main-loop with timeout, wait for events */
err = re_main_timeout(10000);
err = re_main_timeout(1000);
TEST_ERR(err);
TEST_ERR(fix.err);

Expand Down Expand Up @@ -1878,19 +1882,31 @@ int test_call_format_float(void)
err = module_load(".", "auconv");
TEST_ERR(err);

err = test_media_base(AUDIO_MODE_POLL, AUFMT_S16LE);
err = module_load(".", "auresamp");
TEST_ERR(err);

err = test_media_base(AUDIO_MODE_THREAD, AUFMT_S16LE);
err = module_load(".", "opus");
TEST_ERR(err);

err = test_media_base(AUDIO_MODE_POLL, AUFMT_FLOAT);
err = test_media_base(AUDIO_MODE_POLL, AUFMT_S16LE, AUFMT_S16LE);
TEST_ERR(err);

err = test_media_base(AUDIO_MODE_THREAD, AUFMT_FLOAT);
err = test_media_base(AUDIO_MODE_POLL, AUFMT_S16LE, AUFMT_FLOAT);
TEST_ERR(err);

/* TODO: sound card float / ac s16le; wait for PR of @sreimers */

/* TODO: POLL mode*/
/* err = test_media_base(AUDIO_MODE_POLL, AUFMT_FLOAT, AUFMT_S16LE);*/
/* TEST_ERR(err);*/

/* err = test_media_base(AUDIO_MODE_THREAD, AUFMT_S16LE);*/
/* TEST_ERR(err);*/

out:
/* TODO: fix double free or corruption crash */
module_unload("opus");
module_unload("auresamp");
module_unload("auconv");

return err;
Expand Down

0 comments on commit 0325abf

Please sign in to comment.