[farsight2/master] Add unit test for reserve-pt

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:21:43 PST 2008


---
 tests/check/main/rtpcodecs.c |   55 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/tests/check/main/rtpcodecs.c b/tests/check/main/rtpcodecs.c
index 34ec7d1..e8c3710 100644
--- a/tests/check/main/rtpcodecs.c
+++ b/tests/check/main/rtpcodecs.c
@@ -220,6 +220,57 @@ GST_START_TEST (test_rtpcodecs_invalid_remote_codecs)
 GST_END_TEST;
 
 
+GST_START_TEST (test_rtpcodecs_reserved_pt)
+{
+  struct SimpleTestConference *dat = NULL;
+  GList *codecs = NULL, *item = NULL;
+
+  dat = setup_simple_conference (1, "fsrtpconference", "bob at 127.0.0.1");
+
+  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+
+  for (item = g_list_first (codecs); item; item = g_list_next (item))
+  {
+    FsCodec *codec = item->data;
+    if (codec->id == 96)
+      break;
+  }
+
+  fs_codec_list_destroy (codecs);
+
+  if (!item)
+  {
+    g_warning ("Could not find a dynamically allocated codec, skipping testing"
+               " of the payload-type reservation mecanism");
+    goto out;
+  }
+
+  codecs = g_list_prepend (NULL, fs_codec_new (96, "reserve-pt",
+                                               FS_MEDIA_TYPE_AUDIO, 0));
+
+  g_object_set (dat->session, "local-codecs-config", codecs, NULL);
+
+  fs_codec_list_destroy (codecs);
+
+  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+
+  for (item = g_list_first (codecs); item; item = g_list_next (item))
+  {
+    FsCodec *codec = item->data;
+    if (codec->id == 96)
+      break;
+  }
+
+  fs_codec_list_destroy (codecs);
+
+  fail_if (item, "Found codec with payload type 96, even though it should have"
+           " been disabled");
+
+ out:
+  cleanup_simple_conference (dat);
+}
+GST_END_TEST;
+
 static Suite *
 fsrtpcodecs_suite (void)
 {
@@ -245,6 +296,10 @@ fsrtpcodecs_suite (void)
   tcase_add_test (tc_chain, test_rtpcodecs_invalid_remote_codecs);
   suite_add_tcase (s, tc_chain);
 
+  tc_chain = tcase_create ("fsrtpcodecs_reserved_pt");
+  tcase_add_test (tc_chain, test_rtpcodecs_reserved_pt);
+  suite_add_tcase (s, tc_chain);
+
   return s;
 }
 
-- 
1.5.6.5




More information about the farsight-commits mailing list