[farsight2/master] Port the unit tests us negotiated-codecs for everything

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


---
 tests/check/main/rtpcodecs.c     |   30 +++++++++++++++---------------
 tests/check/main/rtpconference.c |   18 +++++++++---------
 tests/check/main/rtpsendcodecs.c |   11 +++++++----
 3 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/tests/check/main/rtpcodecs.c b/tests/check/main/rtpcodecs.c
index 393c264..51ce566 100644
--- a/tests/check/main/rtpcodecs.c
+++ b/tests/check/main/rtpcodecs.c
@@ -47,12 +47,12 @@ GST_START_TEST (test_rtpcodecs_local_codecs_config)
 
   dat = setup_simple_conference (1, "fsrtpconference", "bob at 127.0.0.1");
 
-  g_object_get (dat->session, "local-codecs", &orig_codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &orig_codecs, NULL);
 
   fail_unless (fs_session_set_local_codecs_config (dat->session, orig_codecs,
           &error), "Could not set local codecs as codec config");
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
 
   fail_unless (fs_codec_list_are_equal (orig_codecs, codecs),
       "Setting local codecs as preferences changes the list of local codecs");
@@ -88,7 +88,7 @@ GST_START_TEST (test_rtpcodecs_local_codecs_config)
     codecs = g_list_append (codecs, codec);
   }
 
-  g_signal_connect (dat->session, "notify::local-codecs",
+  g_signal_connect (dat->session, "notify::negotiated-codecs",
       G_CALLBACK (_notify_local_codecs), &local_codecs_notified);
 
   fail_unless (
@@ -113,7 +113,7 @@ GST_START_TEST (test_rtpcodecs_local_codecs_config)
   fs_codec_list_destroy (codecs);
   fs_codec_list_destroy (codecs2);
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
 
   for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
@@ -141,12 +141,12 @@ GST_START_TEST (test_rtpcodecs_local_codecs_config)
       "Could not set local-codecs-config");
   fail_if (error, "Error set while function succeeded?");
   fail_unless (local_codecs_notified, "We were not notified of the change"
-      " in local-codecs");
+      " in negotiated-codecs");
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
 
   fail_unless (fs_codec_list_are_equal (codecs, orig_codecs),
-      "Resetting local-codecs-config failed, codec lists are not equal");
+      "Resetting negotiated-codecs-config failed, codec lists are not equal");
 
   fs_codec_list_destroy (orig_codecs);
 
@@ -292,7 +292,7 @@ GST_START_TEST (test_rtpcodecs_reserved_pt)
 
   dat = setup_simple_conference (1, "fsrtpconference", "bob at 127.0.0.1");
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
   for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
     FsCodec *codec = item->data;
@@ -314,9 +314,9 @@ GST_START_TEST (test_rtpcodecs_reserved_pt)
                                                FS_MEDIA_TYPE_AUDIO, 0));
 
   fail_unless (fs_session_set_local_codecs_config (dat->session, codec_prefs,
-          NULL), "Could not set local-codes config");
+          NULL), "Could not set local codecs config");
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
   for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
     FsCodec *codec = item->data;
@@ -340,7 +340,7 @@ GST_START_TEST (test_rtpcodecs_reserved_pt)
   fail_if (s == NULL, "Could not add stream");
   g_object_unref (p);
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
 
   fail_unless (fs_stream_set_remote_codecs (s, codecs, NULL),
                "Could not set local codecs as remote codecs");
@@ -360,9 +360,9 @@ GST_START_TEST (test_rtpcodecs_reserved_pt)
       "but there was one in the local codecs", id);
 
   fail_unless (fs_session_set_local_codecs_config (dat->session, codec_prefs,
-          NULL), "Could not set local-codes config after set_remote_codecs");
+          NULL), "Could not set local-codecs config after set_remote_codecs");
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
   for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
     FsCodec *codec = item->data;
@@ -377,7 +377,7 @@ GST_START_TEST (test_rtpcodecs_reserved_pt)
   fail_unless (fs_session_set_local_codecs_config (dat->session, codec_prefs,
           NULL), "Could not re-set local-codes config after set_remote_codecs");
 
-  g_object_get (dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
   for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
     FsCodec *codec = item->data;
@@ -613,7 +613,7 @@ run_test_rtpcodecs_config_data (gboolean preset_remotes)
 
   fs_codec_list_destroy (codecs);
 
-  g_object_get (cd.dat->session, "local-codecs", &codecs, NULL);
+  g_object_get (cd.dat->session, "negotiated-codecs", &codecs, NULL);
   for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
     FsCodec *codec = item->data;
diff --git a/tests/check/main/rtpconference.c b/tests/check/main/rtpconference.c
index 057b62e..3d4b002 100644
--- a/tests/check/main/rtpconference.c
+++ b/tests/check/main/rtpconference.c
@@ -55,7 +55,7 @@ GST_START_TEST (test_rtpconference_new)
   struct SimpleTestConference *dat = NULL;
   struct SimpleTestStream *st = NULL;
   guint id = 999;
-  GList *local_codecs = NULL;
+  GList *codecs = NULL;
   FsMediaType *media_type;
   GstPad *sinkpad = NULL;
   gchar *str = NULL;
@@ -78,7 +78,7 @@ GST_START_TEST (test_rtpconference_new)
 
   g_object_get (dat->session,
       "id", &id,
-      "local-codecs", &local_codecs,
+      "negotiated-codecs", &codecs,
       "media-type", &media_type,
       "sink-pad", &sinkpad,
       "conference", &conf,
@@ -86,8 +86,8 @@ GST_START_TEST (test_rtpconference_new)
 
   ts_fail_unless (id == 1, "The id of the first session should be 1 not %d",
       id);
-  ts_fail_if (local_codecs == NULL, "Local codecs should not be NULL");
-  fs_codec_list_destroy (local_codecs);
+  ts_fail_if (codecs == NULL, "Codecs should not be NULL");
+  fs_codec_list_destroy (codecs);
   ts_fail_unless (media_type == FS_MEDIA_TYPE_AUDIO, "Media type isnt audio,"
       " its %d", media_type);
   ts_fail_if (sinkpad == NULL, "Sink pad should not be null");
@@ -643,17 +643,17 @@ set_initial_codecs (
     struct SimpleTestConference *from,
     struct SimpleTestStream *to)
 {
-  GList *local_codecs = NULL;
+  GList *codecs = NULL;
   GList *filtered_codecs = NULL;
   GList *item = NULL;
   GList *rcodecs2 = NULL;
   GError *error = NULL;
 
-  g_object_get (from->session, "local-codecs", &local_codecs, NULL);
+  g_object_get (from->session, "negotiated-codecs", &codecs, NULL);
 
-  ts_fail_if (local_codecs == NULL, "Could not get the local codecs");
+  ts_fail_if (codecs == NULL, "Could not get the codecs");
 
-  for (item = g_list_first (local_codecs); item; item = g_list_next (item))
+  for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
     FsCodec *codec = item->data;
     if (codec->id == 0 || codec->id == 8)
@@ -695,7 +695,7 @@ set_initial_codecs (
   g_clear_error (&error);
 
   g_list_free (filtered_codecs);
-  fs_codec_list_destroy (local_codecs);
+  fs_codec_list_destroy (codecs);
 }
 
 typedef void (*extra_init) (void);
diff --git a/tests/check/main/rtpsendcodecs.c b/tests/check/main/rtpsendcodecs.c
index 3e765f5..69f41e4 100644
--- a/tests/check/main/rtpsendcodecs.c
+++ b/tests/check/main/rtpsendcodecs.c
@@ -182,16 +182,16 @@ build_recv_pipeline (GCallback havedata_handler, gpointer data, gint *port)
 static void
 set_codecs (struct SimpleTestConference *dat, FsStream *stream)
 {
-  GList *local_codecs = NULL;
+  GList *codecs = NULL;
   GList *filtered_codecs = NULL;
   GList *item = NULL;
   GError *error = NULL;
 
-  g_object_get (dat->session, "local-codecs", &local_codecs, NULL);
+  g_object_get (dat->session, "negotiated-codecs", &codecs, NULL);
 
-  ts_fail_if (local_codecs == NULL, "Could not get the local codecs");
+  ts_fail_if (codecs == NULL, "Could not get the local codecs");
 
-  for (item = g_list_first (local_codecs); item; item = g_list_next (item))
+  for (item = g_list_first (codecs); item; item = g_list_next (item))
   {
     FsCodec *codec = item->data;
     if (codec->id == 0 || codec->id == 8)
@@ -221,6 +221,9 @@ set_codecs (struct SimpleTestConference *dat, FsStream *stream)
       ts_fail ("Could not set the remote codecs on stream"
           " and we did NOT get a GError!!");
   }
+
+  g_list_free (filtered_codecs);
+  fs_codec_list_destroy (codecs);
 }
 
 static void
-- 
1.5.6.5




More information about the farsight-commits mailing list