summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--tests/check/Makefile.am12
-rw-r--r--tests/check/main/rtpcodecs.c112
3 files changed, 124 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index e66c30ab..5096dc3a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -38,6 +38,7 @@ tests/check/base/fscodec
tests/check/base/fstransmitter
tests/check/transmitter/rawudp
tests/check/main/rtpconference
+tests/check/main/rtpcodecs
tests/rtp/codec-discovery
aclocal.m4
diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am
index 26be75d6..04fd9f6b 100644
--- a/tests/check/Makefile.am
+++ b/tests/check/Makefile.am
@@ -35,7 +35,8 @@ check_PROGRAMS = \
base/fscodec \
base/fstransmitter \
transmitter/rawudp \
- main/rtpconference
+ main/rtpconference \
+ main/rtpcodecs
AM_CFLAGS = $(FS2_CFLAGS) $(GST_CFLAGS) $(GST_CHECK_CFLAGS)
@@ -67,3 +68,12 @@ main_rtpconference_SOURCES = \
main/generic.h \
main/rtpconference.c
+
+main_rtpcodecs_LDADD = $(LDADD) \
+ $(top_builddir)/gst-libs/gst/farsight/libgstfarsight-0.10.la
+main_rtpcodecs_CFLAGS = $(FS2_INTERNAL_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
+main_rtpcodecs_SOURCES = \
+ main/generic.c \
+ main/generic.h \
+ main/rtpcodecs.c
+
diff --git a/tests/check/main/rtpcodecs.c b/tests/check/main/rtpcodecs.c
new file mode 100644
index 00000000..2aea8e6c
--- /dev/null
+++ b/tests/check/main/rtpcodecs.c
@@ -0,0 +1,112 @@
+/* Farsight 2 unit tests for FsRtpConferenceu
+ *
+ * Copyright (C) 2007 Collabora, Nokia
+ * @author: Olivier Crete <olivier.crete@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gst/check/gstcheck.h>
+#include <gst/farsight/fs-conference-iface.h>
+#include <gst/farsight/fs-stream-transmitter.h>
+
+#include "generic.h"
+
+GST_START_TEST (test_rtpcodecs_local_codecs_config)
+{
+ struct SimpleTestConference *dat = NULL;
+ GList *codecs = NULL, *codecs2 = NULL, *item = NULL;
+ gint has0 = FALSE, has8 = FALSE;
+
+ dat = setup_simple_conference (1, "fsrtpconference", "bob@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 == 0)
+ has0 = TRUE;
+ else if (codec->id == 8)
+ has8 = TRUE;
+ }
+ fail_unless (has0 && has8, "You need the PCMA and PCMU encoder and payloades"
+ " from gst-plugins-good");
+
+ fs_codec_list_destroy (codecs);
+ codecs = NULL;
+
+ codecs = g_list_append (codecs,
+ fs_codec_new (
+ FS_CODEC_ID_DISABLE,
+ "PCMU",
+ FS_MEDIA_TYPE_AUDIO,
+ 8000));
+
+ g_object_set (dat->session, "local-codecs-config", codecs, NULL);
+
+ g_object_get (dat->session, "local-codecs-config", &codecs2, NULL);
+
+ fail_unless (g_list_length (codecs2) == 1,
+ "Returned list from local-codecs-config is wrong");
+
+ fail_unless (fs_codec_are_equal (codecs->data, codecs2->data),
+ "Codecs");
+
+ fs_codec_list_destroy (codecs);
+ fs_codec_list_destroy (codecs2);
+
+ 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;
+ fail_if (!strcmp (codec->encoding_name, "PCMU"),
+ "PCMU codec was not removed as requested");
+ }
+
+ fs_codec_list_destroy (codecs);
+
+ cleanup_simple_conference (dat);
+}
+GST_END_TEST;
+
+
+static Suite *
+fsrtpcodecs_suite (void)
+{
+ Suite *s = suite_create ("fsrtpcodecs");
+ TCase *tc_chain;
+ GLogLevelFlags fatal_mask;
+
+
+ fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
+ fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
+ g_log_set_always_fatal (fatal_mask);
+
+
+ tc_chain = tcase_create ("fsrtpcodecs_local_codecs_config");
+ tcase_set_timeout (tc_chain, 1);
+ tcase_add_test (tc_chain, test_rtpcodecs_local_codecs_config);
+ suite_add_tcase (s, tc_chain);
+
+ return s;
+}
+
+GST_CHECK_MAIN (fsrtpcodecs);