summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>2011-02-28 18:25:34 -0500
committerOlivier CrĂȘte <olivier.crete@collabora.co.uk>2011-05-10 21:15:13 -0400
commit9ad130b60723971127f20b2be4e45da1e357b145 (patch)
tree4100f67f8290c4ab26f5326e8ecc2b0c9094a330 /tests
parentb262c6ccc5eb62f2047fed62b3aa71ce0a6d7daf (diff)
downloadfarstream-9ad130b60723971127f20b2be4e45da1e357b145.tar.gz
tests: Add tests for Rtp Header Extension functions
Diffstat (limited to 'tests')
-rw-r--r--tests/check/base/fscodec.c91
-rw-r--r--tests/check/base/test1.conf17
2 files changed, 107 insertions, 1 deletions
diff --git a/tests/check/base/fscodec.c b/tests/check/base/fscodec.c
index b97d8cc5..40882ec0 100644
--- a/tests/check/base/fscodec.c
+++ b/tests/check/base/fscodec.c
@@ -23,7 +23,8 @@
#endif
#include <gst/check/gstcheck.h>
-#include <gst/farsight/fs-codec.h>
+#include "gst/farsight/fs-codec.h"
+#include "gst/farsight/fs-rtp.h"
#include "testutils.h"
@@ -309,6 +310,92 @@ GST_START_TEST (test_fscodec_keyfile)
}
GST_END_TEST;
+GST_START_TEST (test_fscodec_rtp_hdrext)
+{
+ FsRtpHeaderExtension *hdrext, *hdrext2;
+
+ hdrext = fs_rtp_header_extension_new (1, FS_DIRECTION_BOTH, "uri");
+ hdrext2 = fs_rtp_header_extension_new (1, FS_DIRECTION_BOTH, "uri");
+
+ fail_unless (fs_rtp_header_extension_are_equal (hdrext, hdrext));
+ fail_unless (fs_rtp_header_extension_are_equal (hdrext, hdrext2));
+
+ hdrext2->id = 2;
+ fail_unless (!fs_rtp_header_extension_are_equal (hdrext, hdrext2));
+
+ hdrext2->id = 1;
+ fail_unless (fs_rtp_header_extension_are_equal (hdrext, hdrext2));
+
+ hdrext2->direction = FS_DIRECTION_NONE;
+ fail_unless (!fs_rtp_header_extension_are_equal (hdrext, hdrext2));
+ fs_rtp_header_extension_destroy (hdrext2);
+
+ hdrext2 = fs_rtp_header_extension_copy (hdrext);
+
+ fail_unless (fs_rtp_header_extension_are_equal (hdrext, hdrext2));
+
+ fs_rtp_header_extension_destroy (hdrext2);
+ fs_rtp_header_extension_destroy (hdrext);
+}
+GST_END_TEST;
+
+
+GST_START_TEST (test_fscodec_rtp_hdrext_keyfile)
+{
+ GList *extensions = NULL;
+ GError *error = NULL;
+ gchar *filename = NULL;
+ FsRtpHeaderExtension *comparison;
+
+ fail_if (fs_rtp_header_extension_list_from_keyfile ("invalid-filename",
+ FS_MEDIA_TYPE_AUDIO, &error));
+ fail_if (error == NULL);
+ fail_unless (error->domain == G_FILE_ERROR);
+ g_clear_error (&error);
+
+ filename = get_fullpath ("base/test1.conf");
+ extensions = fs_rtp_header_extension_list_from_keyfile (filename,
+ FS_MEDIA_TYPE_AUDIO, &error);
+ g_free (filename);
+ fail_unless (error == NULL);
+ fail_if (extensions == NULL);
+
+ comparison = fs_rtp_header_extension_new (1, FS_DIRECTION_BOTH,
+ "http://example.com/rtp-hdrext1");
+ fail_unless (fs_rtp_header_extension_are_equal (extensions->data,
+ comparison));
+ fs_rtp_header_extension_destroy (comparison);
+
+ comparison = fs_rtp_header_extension_new (2, FS_DIRECTION_RECV,
+ "http://example.com/rtp-hdrext2");
+ fail_unless (fs_rtp_header_extension_are_equal (extensions->next->data,
+ comparison));
+ fs_rtp_header_extension_destroy (comparison);
+
+ fail_unless (extensions->next->next == NULL);
+
+ fs_rtp_header_extension_list_destroy (extensions);
+
+
+
+ filename = get_fullpath ("base/test1.conf");
+ extensions = fs_rtp_header_extension_list_from_keyfile (filename,
+ FS_MEDIA_TYPE_VIDEO, &error);
+ g_free (filename);
+ fail_unless (error == NULL);
+ fail_if (extensions == NULL);
+
+ comparison = fs_rtp_header_extension_new (1, FS_DIRECTION_BOTH,
+ "http://example.com/rtp-hdrext1");
+ fail_unless (fs_rtp_header_extension_are_equal (extensions->data,
+ comparison));
+ fs_rtp_header_extension_destroy (comparison);
+
+ fail_unless (extensions->next == NULL);
+ fs_rtp_header_extension_list_destroy (extensions);
+}
+GST_END_TEST;
+
static Suite *
fscodec_suite (void)
{
@@ -324,6 +411,8 @@ fscodec_suite (void)
tcase_add_test (tc_chain, test_fscodec_copy);
tcase_add_test (tc_chain, test_fscodec_null);
tcase_add_test (tc_chain, test_fscodec_keyfile);
+ tcase_add_test (tc_chain, test_fscodec_rtp_hdrext);
+ tcase_add_test (tc_chain, test_fscodec_rtp_hdrext_keyfile);
return s;
}
diff --git a/tests/check/base/test1.conf b/tests/check/base/test1.conf
index e4367799..b7f71f12 100644
--- a/tests/check/base/test1.conf
+++ b/tests/check/base/test1.conf
@@ -47,3 +47,20 @@ asdasd=11
channels=1das
maxptime=532
ptime=42
+
+[rtp-hdrext:audio:1]
+id=1
+uri=http://example.com/rtp-hdrext1
+
+[rtp-hdrext:invalid:1]
+id=3
+uri=http://example.com/rtp-hdrext3
+
+[rtp-hdrext:audio:2]
+id=2
+uri=http://example.com/rtp-hdrext2
+direction=receive
+
+[rtp-hdrext:video:1]
+id=1
+uri=http://example.com/rtp-hdrext1