summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/main.c1
-rw-r--r--test/srcs.mk1
-rw-r--r--test/test.h2
-rw-r--r--test/video.c38
4 files changed, 42 insertions, 0 deletions
diff --git a/test/main.c b/test/main.c
index b9f8601..ee3c58e 100644
--- a/test/main.c
+++ b/test/main.c
@@ -53,6 +53,7 @@ static const struct test tests[] = {
TEST(test_ua_register_auth),
TEST(test_ua_register_auth_dns),
TEST(test_uag_find_param),
+ TEST(test_video),
};
diff --git a/test/srcs.mk b/test/srcs.mk
index b3a2637..5a0457d 100644
--- a/test/srcs.mk
+++ b/test/srcs.mk
@@ -19,6 +19,7 @@ TEST_SRCS += mos.c
TEST_SRCS += net.c
TEST_SRCS += play.c
TEST_SRCS += ua.c
+TEST_SRCS += video.c
#
diff --git a/test/test.h b/test/test.h
index 29e9569..3d55cff 100644
--- a/test/test.h
+++ b/test/test.h
@@ -207,6 +207,8 @@ int test_call_video(void);
int test_call_aulevel(void);
int test_call_progress(void);
+int test_video(void);
+
#ifdef __cplusplus
extern "C" {
diff --git a/test/video.c b/test/video.c
new file mode 100644
index 0000000..09c5e77
--- /dev/null
+++ b/test/video.c
@@ -0,0 +1,38 @@
+/**
+ * @file test/video.c Baresip selftest -- video
+ *
+ * Copyright (C) 2010 - 2017 Creytiv.com
+ */
+
+#include <re.h>
+#include <baresip.h>
+#include "test.h"
+
+
+#define DEBUG_MODULE "video"
+#define DEBUG_LEVEL 5
+#include <re_dbg.h>
+
+
+int test_video(void)
+{
+ int err = 0;
+
+ /* test with framerate of zero */
+ ASSERT_EQ(0, video_calc_rtp_timestamp(1, 0));
+
+ ASSERT_EQ( 0, video_calc_rtp_timestamp( 0, 30));
+ ASSERT_EQ( 3000, video_calc_rtp_timestamp( 1, 30));
+ ASSERT_EQ( 30000, video_calc_rtp_timestamp( 10, 30));
+ ASSERT_EQ( 300000, video_calc_rtp_timestamp( 100, 30));
+ ASSERT_EQ( 3000000, video_calc_rtp_timestamp( 1000, 30));
+ ASSERT_EQ( 30000000, video_calc_rtp_timestamp( 10000, 30));
+ ASSERT_EQ( 300000000, video_calc_rtp_timestamp( 100000, 30));
+ ASSERT_EQ(3000000000, video_calc_rtp_timestamp(1000000, 30));
+
+ ASSERT_EQ(4294965000, video_calc_rtp_timestamp(1431655, 30));
+ ASSERT_EQ( 704, video_calc_rtp_timestamp(1431656, 30));
+
+ out:
+ return err;
+}