summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-06-02 22:07:34 +0200
committerGitHub <noreply@github.com>2017-06-02 22:07:34 +0200
commit9c2b349424c49cd94e18c788e6fe9527d04be5d1 (patch)
treec295c3ec91f5ee51ff8bb482d9865e125fe1128c /test
parent0338f6dca9ed181c2e182c7bf8185c23ec880adb (diff)
add RTP Header extension for Client-to-Mixer Audio Level Indication (#264)
* add RTP Header extension for Client-to-Mixer Audio Level Indication https://tools.ietf.org/html/rfc6464 requires libre from this commit or later: https://github.com/creytiv/re/commit/1544a1e375c76a80084b411d21b0431f95e9cdfb * fix warnings * fix warnings * minor cleanup
Diffstat (limited to 'test')
-rw-r--r--test/call.c64
-rw-r--r--test/main.c1
-rw-r--r--test/test.h1
3 files changed, 66 insertions, 0 deletions
diff --git a/test/call.c b/test/call.c
index f3881c6..60af1b2 100644
--- a/test/call.c
+++ b/test/call.c
@@ -703,3 +703,67 @@ int test_call_video(void)
return err;
}
#endif
+
+
+static void mock_sample_handler(const int16_t *sampv, size_t sampc, void *arg)
+{
+ struct fixture *fix = arg;
+ bool got_aulevel;
+ (void)sampv;
+ (void)sampc;
+
+ got_aulevel =
+ 0 == audio_level_get(call_audio(ua_call(fix->a.ua)), NULL) &&
+ 0 == audio_level_get(call_audio(ua_call(fix->b.ua)), NULL);
+
+ if (got_aulevel)
+ re_cancel();
+}
+
+
+int test_call_aulevel(void)
+{
+ struct fixture fix, *f = &fix;
+ struct ausrc *ausrc = NULL;
+ struct auplay *auplay = NULL;
+ double lvl;
+ int err = 0;
+
+ /* Use a low packet time, so the test completes quickly */
+ fixture_init_prm(f, ";ptime=1");
+
+ conf_config()->audio.level = true;
+
+ err = mock_ausrc_register(&ausrc);
+ TEST_ERR(err);
+ err = mock_auplay_register(&auplay, mock_sample_handler, f);
+ TEST_ERR(err);
+
+ f->estab_action = ACTION_NOTHING;
+
+ /* Make a call from A to B */
+ err = ua_connect(f->a.ua, 0, NULL, f->buri, NULL, VIDMODE_OFF);
+ TEST_ERR(err);
+
+ /* run main-loop with timeout, wait for events */
+ err = re_main_timeout(5000);
+ TEST_ERR(err);
+ TEST_ERR(fix.err);
+
+ /* verify audio silence */
+ err = audio_level_get(call_audio(ua_call(f->a.ua)), &lvl);
+ TEST_ERR(err);
+ ASSERT_EQ(-96, lvl);
+ err = audio_level_get(call_audio(ua_call(f->b.ua)), &lvl);
+ TEST_ERR(err);
+ ASSERT_EQ(-96, lvl);
+
+ out:
+ conf_config()->audio.level = false;
+
+ fixture_close(f);
+ mem_deref(auplay);
+ mem_deref(ausrc);
+
+ return err;
+}
diff --git a/test/main.c b/test/main.c
index f443dcb..aa56420 100644
--- a/test/main.c
+++ b/test/main.c
@@ -33,6 +33,7 @@ static const struct test tests[] = {
TEST(test_call_multiple),
TEST(test_call_max),
TEST(test_call_dtmf),
+ TEST(test_call_aulevel),
#ifdef USE_VIDEO
TEST(test_call_video),
#endif
diff --git a/test/test.h b/test/test.h
index a68d61d..355d698 100644
--- a/test/test.h
+++ b/test/test.h
@@ -204,6 +204,7 @@ int test_call_multiple(void);
int test_call_max(void);
int test_call_dtmf(void);
int test_call_video(void);
+int test_call_aulevel(void);
#ifdef __cplusplus