From olivier.crete at collabora.co.uk Tue Jan 5 09:37:48 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Tue, 05 Jan 2010 17:37:48 -0000 Subject: [farsight2/master] codec: Add maxptime Message-ID: <20100105173742.EA200102B3B@dhansak.collabora.co.uk> --- gst-libs/gst/farsight/fs-codec.c | 12 ++++++++++++ gst-libs/gst/farsight/fs-codec.h | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c index e9dd4b4..f57da6b 100644 --- a/gst-libs/gst/farsight/fs-codec.c +++ b/gst-libs/gst/farsight/fs-codec.c @@ -158,6 +158,7 @@ fs_codec_copy (const FsCodec * codec) copy->media_type = codec->media_type; copy->clock_rate = codec->clock_rate; copy->channels = codec->channels; + copy->ABI.ABI.maxptime = codec->ABI.ABI.maxptime; copy->encoding_name = g_strdup (codec->encoding_name); @@ -356,6 +357,13 @@ fs_codec_list_from_keyfile (const gchar *filename, GError **error) goto keyerror; } + } else if (!g_ascii_strcasecmp ("maxptime", keys[j])) { + codec->ABI.ABI.maxptime = g_key_file_get_integer (keyfile, groups[i], + keys[j], &gerror); + if (gerror) { + codec->ABI.ABI.maxptime = 0; + goto keyerror; + } } else { FsCodecParameter *param = g_slice_new (FsCodecParameter); @@ -450,6 +458,9 @@ fs_codec_to_string (const FsCodec *codec) codec->id, fs_media_type_to_string (codec->media_type), codec->encoding_name, codec->clock_rate, codec->channels); + if (codec->ABI.ABI.maxptime) + g_string_append_printf (string, " maxptime=%u", codec->ABI.ABI.maxptime); + for (item = codec->optional_params; item; item = g_list_next (item)) { @@ -522,6 +533,7 @@ fs_codec_are_equal (const FsCodec *codec1, const FsCodec *codec2) codec1->media_type != codec2->media_type || codec1->clock_rate != codec2->clock_rate || codec1->channels != codec2->channels || + codec1->ABI.ABI.maxptime != codec2->ABI.ABI.maxptime || codec1->encoding_name == NULL || codec2->encoding_name == NULL || g_ascii_strcasecmp (codec1->encoding_name, codec2->encoding_name)) diff --git a/gst-libs/gst/farsight/fs-codec.h b/gst-libs/gst/farsight/fs-codec.h index 43044c0..496be5e 100644 --- a/gst-libs/gst/farsight/fs-codec.h +++ b/gst-libs/gst/farsight/fs-codec.h @@ -81,6 +81,7 @@ typedef enum * @clock_rate: clock rate of this stream * @channels: Number of channels codec should decode * @optional_params: key pairs of param name to param data + * @maxptime: The maximum size (in ms) of a sent buffer * * This structure reprensents one codec that can be offered or received */ @@ -94,8 +95,13 @@ struct _FsCodec guint channels; GList *optional_params; /*< private >*/ - gpointer _padding[4]; /* padding for binary-compatible + union { + struct { + guint maxptime; + } ABI; + gpointer _padding[4]; /* padding for binary-compatible expansion*/ + } ABI; }; /** -- 1.5.6.5 From olivier.crete at collabora.co.uk Sun Jan 3 17:16:12 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Sun, 3 Jan 2010 20:16:12 -0500 Subject: [farsight2/master] rtcpfilter: Reduce the packet size when reducing the packet Message-ID: <20100105173744.276B0102B3B@dhansak.collabora.co.uk> --- gst/rtcpfilter/fs-rtcp-filter.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/gst/rtcpfilter/fs-rtcp-filter.c b/gst/rtcpfilter/fs-rtcp-filter.c index 1f6ed04..5fb6100 100644 --- a/gst/rtcpfilter/fs-rtcp-filter.c +++ b/gst/rtcpfilter/fs-rtcp-filter.c @@ -226,6 +226,8 @@ fs_rtcp_filter_transform_ip (GstBaseTransform *transform, GstBuffer *buf) memmove (GST_BUFFER_DATA (buf) + packet.offset + 8, GST_BUFFER_DATA (buf) + nextpacket.offset, GST_BUFFER_SIZE (buf) - nextpacket.offset); + GST_BUFFER_SIZE (buf) -= nextpacket.offset - packet.offset - 8; + if (!gst_rtcp_buffer_get_first_packet (buf, &packet)) break; } -- 1.5.6.5 From olivier.crete at collabora.co.uk Sun Jan 3 16:07:14 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Sun, 3 Jan 2010 19:07:14 -0500 Subject: [farsight2/master] tests: Skip libnice tests if it finds no local candidates Message-ID: <20100105173744.0AD9F102B3B@dhansak.collabora.co.uk> --- tests/check/transmitter/nice.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/tests/check/transmitter/nice.c b/tests/check/transmitter/nice.c index cb931c4..3aafb5f 100644 --- a/tests/check/transmitter/nice.c +++ b/tests/check/transmitter/nice.c @@ -107,6 +107,14 @@ set_the_candidates (gpointer user_data) gboolean ret; GError *error = NULL; + if (!candidates) + { + g_debug ("Skipping libnice check because it found NO local candidates"); + g_atomic_int_set(&running, FALSE); + g_main_loop_quit (loop); + return FALSE; + } + if (force_candidates) { GList *item = NULL; -- 1.5.6.5 From olivier.crete at collabora.co.uk Sun Jan 3 17:25:28 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Sun, 3 Jan 2010 20:25:28 -0500 Subject: [farsight2/master] tests: Skip tests if no local candidates are produced Message-ID: <20100105173744.401AB102B3B@dhansak.collabora.co.uk> --- tests/check/rtp/conference.c | 41 ++++++++++++++++++++++++++++++++++++++++- tests/check/rtp/generic.h | 2 ++ 2 files changed, 42 insertions(+), 1 deletions(-) diff --git a/tests/check/rtp/conference.c b/tests/check/rtp/conference.c index 8ca60ad..84c9dec 100644 --- a/tests/check/rtp/conference.c +++ b/tests/check/rtp/conference.c @@ -142,6 +142,8 @@ _new_local_candidate (FsStream *stream, FsCandidate *candidate) if (candidate->component_id == FS_COMPONENT_RTCP && no_rtcp) return; + st->got_candidates = TRUE; + GST_DEBUG ("%d:%d: Setting remote candidate for component %d", other_st->dat->id, other_st->target->id, @@ -175,6 +177,20 @@ _current_send_codec_changed (FsSession *session, FsCodec *codec) g_free (str); } +static void +_local_candidates_prepared (FsStream *stream) +{ + struct SimpleTestStream *st = g_object_get_data (G_OBJECT (stream), + "SimpleTestStream"); + + if (!st->got_candidates) + { + g_debug ("Skipping test because there are no candidates"); + g_main_loop_quit (loop); + } + +} + static gboolean _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data) @@ -296,7 +312,8 @@ _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data) ts_fail_unless ( gst_implements_interface_check (GST_MESSAGE_SRC (message), FS_TYPE_CONFERENCE), - "Received farsight-error from non-farsight element"); + "Received farsight-current-send-codec-change from non-farsight" + " element"); ts_fail_unless ( gst_structure_has_field_typed (s, "session", FS_TYPE_SESSION), @@ -318,6 +335,28 @@ _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data) _current_send_codec_changed (session, codec); } + else if (gst_structure_has_name (s, + "farsight-local-candidates-prepared")) + { + FsStream *stream; + const GValue *value; + + ts_fail_unless ( + gst_implements_interface_check (GST_MESSAGE_SRC (message), + FS_TYPE_CONFERENCE), + "Received farsight-local-candidates-prepared from non-farsight" + " element"); + + ts_fail_unless ( + gst_structure_has_field_typed (s, "stream", FS_TYPE_STREAM), + "farsight-local-candidates-prepared structure" + " has no stream field"); + + value = gst_structure_get_value (s, "stream"); + stream = g_value_get_object (value); + + _local_candidates_prepared (stream); + } } break; diff --git a/tests/check/rtp/generic.h b/tests/check/rtp/generic.h index a5774f3..1167250 100644 --- a/tests/check/rtp/generic.h +++ b/tests/check/rtp/generic.h @@ -51,6 +51,8 @@ struct SimpleTestStream { GCallback handoff_handler; + gboolean got_candidates; + gint flags; }; -- 1.5.6.5 From olivier.crete at collabora.co.uk Tue Jan 5 09:14:40 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Tue, 5 Jan 2010 12:14:40 -0500 Subject: [farsight2/master] Version 0.0.17 Message-ID: <20100105173744.A0F55102B3A@dhansak.collabora.co.uk> --- configure.ac | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index a3c7595..8a81632 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ dnl please read gstreamer/docs/random/autotools before changing this file dnl initialize autoconf dnl releases only do -Wall, cvs and prerelease does -Werror too dnl use a three digit version number for releases, and four for cvs/prerelease -AC_INIT(Farsight2, 0.0.16.1, +AC_INIT(Farsight2, 0.0.17, https://bugs.freedesktop.org/enter_bug.cgi?product=Farsight, farsight2) @@ -45,7 +45,7 @@ dnl - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 dnl - interfaces added -> increment AGE dnl - interfaces removed -> AGE = 0 dnl sets FS2_LT_LDFLAGS -AS_LIBTOOL(FS2, 3, 1, 3) +AS_LIBTOOL(FS2, 4, 0, 4) dnl FIXME: this macro doesn't actually work; dnl the generated libtool script has no support for the listed tags. -- 1.5.6.5 From olivier.crete at collabora.co.uk Mon Jan 4 12:57:08 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Mon, 4 Jan 2010 15:57:08 -0500 Subject: [farsight2/master] tests: Add test for telephone-event events parameter nego Message-ID: <20100105173744.83AB4102B39@dhansak.collabora.co.uk> --- tests/check/rtp/codecs.c | 155 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 154 insertions(+), 1 deletions(-) diff --git a/tests/check/rtp/codecs.c b/tests/check/rtp/codecs.c index 0cfd251..7a81140 100644 --- a/tests/check/rtp/codecs.c +++ b/tests/check/rtp/codecs.c @@ -1158,6 +1158,156 @@ GST_START_TEST (test_rtpcodecs_ptime) } GST_END_TEST; +static void +test_one_telephone_event_codec (FsSession *session, FsStream *stream, + FsCodec *prefcodec, FsCodec *incodec, FsCodec *outcodec) +{ + GList *codecs = NULL; + FsCodec *codec = NULL; + GError *error = NULL; + + codecs = g_list_append (NULL, fs_codec_copy (prefcodec)); + codecs = g_list_append (codecs, incodec); + fail_unless (fs_stream_set_remote_codecs (stream, codecs, &error)); + fail_unless (error == NULL); + fs_codec_list_destroy (codecs); + + g_object_get (session, "codecs", &codecs, NULL); + if (outcodec) + { + fail_unless (g_list_length (codecs) == 2); + codec = codecs->data; + fail_unless (codec->id == prefcodec->id); + codec = codecs->next->data; + fail_unless (fs_codec_are_equal (codec, outcodec)); + fs_codec_destroy (outcodec); + } + else + { + fail_unless (g_list_length (codecs) == 1); + } + + fs_codec_list_destroy (codecs); +} + +GST_START_TEST (test_rtpcodecs_telephone_event_nego) +{ + struct SimpleTestConference *dat = NULL; + GList *codecs = NULL, *item = NULL; + FsCodec *codec = NULL; + FsCodec *outcodec = NULL; + FsCodec *prefcodec = NULL; + FsParticipant *participant; + FsStream *stream; + gboolean has_telephone_event_codec = FALSE; + + dat = setup_simple_conference (1, "fsrtpconference", "bob at 127.0.0.1"); + + g_object_get (dat->session, "codecs", &codecs, NULL); + for (item = g_list_first (codecs); item; item = g_list_next (item)) + { + FsCodec *tmpcodec = item->data; + + if (tmpcodec->id == 0 || tmpcodec->id == 8) + { + if (!prefcodec) + { + prefcodec = fs_codec_copy (tmpcodec); + } + } else if (!strcmp (tmpcodec->encoding_name, "telephone-event")) { + has_telephone_event_codec = TRUE; + if (fs_codec_get_optional_parameter (tmpcodec, "telephone-event", NULL) && + !fs_codec_get_optional_parameter (tmpcodec, "telephone-event", "0-16")) + { + g_debug ("Telephone-event does no have the expected events=0-16"); + has_telephone_event_codec = FALSE; + } + } + } + fs_codec_list_destroy (codecs); + + if (!has_telephone_event_codec) { + g_debug ("telephone-event elements not detected, skipping test"); + return; + } + + participant = fs_conference_new_participant ( + FS_CONFERENCE (dat->conference), "name", NULL); + fail_if (participant == NULL, "Could not add participant to conference"); + + stream = fs_session_new_stream (dat->session, participant, + FS_DIRECTION_BOTH, "rawudp", 0, NULL, NULL); + fail_if (stream == NULL, "Could not add stream to session"); + + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "0-16"); + outcodec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (outcodec, "events", "0-16"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + outcodec); + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "0,2-16"); + outcodec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (outcodec, "events", "0,2-16"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + outcodec); + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "0,2-16"); + outcodec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (outcodec, "events", "0,2-16"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + outcodec); + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "2"); + outcodec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (outcodec, "events", "2"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + outcodec); + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "2-3"); + outcodec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (outcodec, "events", "2-3"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + outcodec); + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "0,10-26,32"); + outcodec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (outcodec, "events", "0,10-16"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + outcodec); + + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "0,10"); + fs_codec_add_optional_parameter (codec, "events", "1,2"); + outcodec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (outcodec, "events", "0,10"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + outcodec); + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "0,2-16-2"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + NULL); + + codec = fs_codec_new (100, "telephone-event", FS_MEDIA_TYPE_AUDIO, 8000); + fs_codec_add_optional_parameter (codec, "events", "0,,3"); + test_one_telephone_event_codec (dat->session, stream, prefcodec, codec, + NULL); + + + g_object_unref (stream); + g_object_unref (participant); + cleanup_simple_conference (dat); +} +GST_END_TEST; + static Suite * fsrtpcodecs_suite (void) @@ -1204,11 +1354,14 @@ fsrtpcodecs_suite (void) tcase_add_test (tc_chain, test_rtpcodecs_dynamic_pt); suite_add_tcase (s, tc_chain); - tc_chain = tcase_create ("fsrtpcodecs_ptime"); tcase_add_test (tc_chain, test_rtpcodecs_ptime); suite_add_tcase (s, tc_chain); + tc_chain = tcase_create ("fsrtpcodecs_telephone_event-nego"); + tcase_add_test (tc_chain, test_rtpcodecs_telephone_event_nego); + suite_add_tcase (s, tc_chain); + return s; } -- 1.5.6.5 From olivier.crete at collabora.co.uk Sat Jan 2 14:47:09 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Sat, 2 Jan 2010 17:47:09 -0500 Subject: [farsight2/master] rtpspecificnego: Add handling of telephone-event event ranges Message-ID: <20100105173744.57955102B3B@dhansak.collabora.co.uk> --- gst/fsrtpconference/fs-rtp-specific-nego.c | 229 ++++++++++++++++++++++++++++ 1 files changed, 229 insertions(+), 0 deletions(-) diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.c b/gst/fsrtpconference/fs-rtp-specific-nego.c index c241d62..0900d24 100644 --- a/gst/fsrtpconference/fs-rtp-specific-nego.c +++ b/gst/fsrtpconference/fs-rtp-specific-nego.c @@ -64,6 +64,9 @@ sdp_is_compat_h263_2000 (FsCodec *local_codec, FsCodec *remote_codec, static FsCodec * sdp_is_compat_theora_vorbis (FsCodec *local_codec, FsCodec *remote_codec, gboolean validate_config); +static FsCodec * +sdp_is_compat_telephone_event (FsCodec *local_codec, FsCodec *remote_codec, + gboolean validate_config); static struct SdpCompatCheck sdp_compat_checks[] = { {FS_MEDIA_TYPE_AUDIO, "iLBC", sdp_is_compat_ilbc, @@ -77,6 +80,8 @@ static struct SdpCompatCheck sdp_compat_checks[] = { {FS_MEDIA_TYPE_VIDEO, "H264", sdp_is_compat_default, {"sprop-parameter-sets", "sprop-interleaving-depth", "sprop-deint-buf-req", "sprop-init-buf-time", "sprop-max-don-diff", NULL}}, + {FS_MEDIA_TYPE_AUDIO, "telephone-event", sdp_is_compat_telephone_event, + {NULL}}, {0, NULL, NULL} }; @@ -397,3 +402,227 @@ gboolean validate_config) return sdp_is_compat_default (local_codec, remote_codec, validate_config); } + +struct event_range { + int first; + int last; +}; + +static gint +event_range_cmp (gconstpointer a, gconstpointer b) +{ + const struct event_range *era = a; + const struct event_range *erb = b; + + return era->first - erb->first; +} + +static GList * +parse_events (const gchar *events) +{ + gchar **ranges_strv; + GList *ranges = NULL; + int i; + + ranges_strv = g_strsplit (events, ",", 0); + + for (i = 0; ranges_strv[i]; i++) + { + struct event_range *er = g_slice_new (struct event_range); + + er->first = atoi (ranges_strv[i]); + if (index (ranges_strv[i], '-')) + er->last = atoi (index (ranges_strv[i], '-') + 1); + + ranges = g_list_insert_sorted (ranges, er, event_range_cmp); + } + + g_strfreev (ranges_strv); + + return ranges; +} + +static void +event_range_free (gpointer data) +{ + g_slice_free (struct event_range, data); +} + +static gchar * +event_intersection (const gchar *remote_events, const gchar *local_events) +{ + GList *remote_ranges = NULL; + GList *local_ranges = NULL; + GList *intersected_ranges = NULL; + GList *item; + struct event_range *new_er = NULL; + GString *intersection_gstr; + + if (!g_regex_match_simple ("^[0-9]+(-[0-9]+)?(,[0-9]+(-[0-9]+)?)*$", + remote_events, 0, 0)) + { + GST_DEBUG ("Invalid remote events (events=%s)", remote_events); + return NULL; + } + + if (!g_regex_match_simple ("^[0-9]+(-[0-9]+)?(,[0-9]+(-[0-9]+)?)*$", + local_events, 0, 0)) + { + GST_DEBUG ("Invalid local events (events=%s)", local_events); + return NULL; + } + + remote_ranges = parse_events (remote_events); + local_ranges = parse_events (local_events); + + while ((item = remote_ranges) != NULL) + { + struct event_range *er1 = item->data; + GList *item2; + + while ((item2 = local_ranges) != NULL) + { + struct event_range *er2 = item2->data; + + if (er1->last < er2->first) + break; + + if (er1->first < er2->last) + { + int new_first = MAX (er1->first, er2->first); + int new_last = MIN (er1->last, er2->last); + + if (new_er && new_er->last == new_first) + { + new_er->last = new_last; + } + else + { + new_er = g_slice_new (struct event_range); + new_er->first = new_first; + new_er->last = new_last; + intersected_ranges = g_list_append (intersected_ranges, new_er); + } + } + local_ranges = g_list_delete_link (local_ranges, item2); + event_range_free (er2); + } + + remote_ranges = g_list_delete_link (remote_ranges, item); + event_range_free (er1); + } + + if (!intersected_ranges) + { + GST_DEBUG ("There is no intersection before the events %s and %s", + remote_events, local_events); + return NULL; + } + + intersection_gstr = g_string_new (""); + + while ((item = intersected_ranges) != NULL) + { + struct event_range *er = item->data; + + if (intersection_gstr->len) + g_string_append_c (intersection_gstr, ','); + + if (er->first == er->last) + g_string_append_printf (intersection_gstr, "%d", er->first); + else + g_string_append_printf (intersection_gstr, "%d-%d", er->first, er->last); + + intersected_ranges = g_list_delete_link (intersected_ranges, item); + event_range_free (er); + } + + return g_string_free (intersection_gstr, FALSE); +} + +static FsCodec * +sdp_is_compat_telephone_event (FsCodec *local_codec, FsCodec *remote_codec, + gboolean validate_config) +{ + FsCodec *negotiated_codec = NULL; + GList *local_param_list = NULL, *negotiated_param_list = NULL; + + GST_LOG ("Using telephone-event codec negotiation function"); + + if ((local_codec->clock_rate || validate_config) && + remote_codec->clock_rate && + local_codec->clock_rate != remote_codec->clock_rate) + { + GST_LOG ("Clock rates differ local=%u remote=%u", local_codec->clock_rate, + remote_codec->clock_rate); + return NULL; + } + + negotiated_codec = codec_copy_without_config (remote_codec); + + negotiated_codec->ABI.ABI.ptime = local_codec->ABI.ABI.ptime; + negotiated_codec->ABI.ABI.maxptime = local_codec->ABI.ABI.maxptime; + + /* Lets fix here missing clock rates and channels counts */ + if (negotiated_codec->channels == 0 && local_codec->channels) + negotiated_codec->channels = local_codec->channels; + if (negotiated_codec->clock_rate == 0) + negotiated_codec->clock_rate = local_codec->clock_rate; + + for (local_param_list = local_codec->optional_params; + local_param_list; + local_param_list = g_list_next (local_param_list)) + { + FsCodecParameter *local_param = local_param_list->data; + + for (negotiated_param_list = negotiated_codec->optional_params; + negotiated_param_list; + negotiated_param_list = g_list_next (negotiated_param_list)) + { + FsCodecParameter *negotiated_param = negotiated_param_list->data; + + if (!strcmp (negotiated_param->name, "")) + { + g_free (negotiated_param->name); + negotiated_param->name = g_strdup ("events"); + } + + if (!g_ascii_strcasecmp (local_param->name, negotiated_param->name)) + { + if (!strcmp (local_param->value, negotiated_param->value)) + { + break; + } + else if (!g_ascii_strcasecmp (negotiated_param->name, "events")) + { + gchar *events = event_intersection (negotiated_param->value, + local_param->value); + if (!events) + { + GST_LOG ("Non-intersecting values for %s, local=%s remote=%s", + local_param->name, local_param->value, negotiated_param->value); + fs_codec_destroy (negotiated_codec); + return NULL; + } + g_free (negotiated_param->value); + negotiated_param->value = events; + } + else + { + GST_LOG ("Different values for %s, local=%s remote=%s", + local_param->name, local_param->value, negotiated_param->value); + fs_codec_destroy (negotiated_codec); + return NULL; + } + } + } + + /* Let's add the local param to the negotiated codec if it does not exist in + * the remote codec */ + if (!negotiated_param_list) + fs_codec_add_optional_parameter (negotiated_codec, local_param->name, + local_param->value); + } + + return negotiated_codec; +} -- 1.5.6.5 From olivier.crete at collabora.co.uk Sun Jan 3 16:05:01 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Sun, 3 Jan 2010 19:05:01 -0500 Subject: [farsight2/master] rtpdtmfsoundsource: Respect the ptime/maxptime too Message-ID: <20100105173743.E549C102B3B@dhansak.collabora.co.uk> --- gst/fsrtpconference/fs-rtp-dtmf-sound-source.c | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gst/fsrtpconference/fs-rtp-dtmf-sound-source.c b/gst/fsrtpconference/fs-rtp-dtmf-sound-source.c index 6872619..ffb307e 100644 --- a/gst/fsrtpconference/fs-rtp-dtmf-sound-source.c +++ b/gst/fsrtpconference/fs-rtp-dtmf-sound-source.c @@ -1,9 +1,9 @@ /* * Farsight2 - Farsight RTP DTMF Sound Source * - * Copyright 2007 Collabora Ltd. + * Copyright 2007-2009 Collabora Ltd. * @author: Olivier Crete - * Copyright 2007 Nokia Corp. + * Copyright 2007-2009 Nokia Corp. * * fs-rtp-dtmf-sound-source.c - A Farsight RTP Sound Source gobject * @@ -32,6 +32,7 @@ #include "fs-rtp-conference.h" #include "fs-rtp-discover-codecs.h" #include "fs-rtp-codec-negotiation.h" +#include "fs-rtp-specific-nego.h" #include "fs-rtp-dtmf-sound-source.h" @@ -113,7 +114,8 @@ _is_law_codec (CodecAssociation *ca, gpointer user_data) static FsCodec * get_pcm_law_sound_codec (GList *codecs, gchar **encoder_name, - gchar **payloader_name) + gchar **payloader_name, + CodecAssociation **out_ca) { CodecAssociation *ca = NULL; @@ -137,6 +139,9 @@ get_pcm_law_sound_codec (GList *codecs, *payloader_name = "rtppcmapay"; } + if (out_ca) + *out_ca = ca; + return ca->codec; } @@ -186,7 +191,7 @@ fs_rtp_dtmf_sound_source_get_codec (FsRtpSpecialSourceClass *klass, if (selected_codec->clock_rate == 8000) { codec = get_pcm_law_sound_codec (negotiated_codec_associations, - &encoder_name, &payloader_name); + &encoder_name, &payloader_name, NULL); if (codec) { if (!_check_element_factory (encoder_name)) return NULL; @@ -226,7 +231,7 @@ fs_rtp_dtmf_sound_source_build (FsRtpSpecialSource *source, if (selected_codec->clock_rate == 8000) telephony_codec = get_pcm_law_sound_codec (negotiated_codec_associations, - &encoder_name, &payloader_name); + &encoder_name, &payloader_name, &ca); if (!telephony_codec) { @@ -240,6 +245,11 @@ fs_rtp_dtmf_sound_source_build (FsRtpSpecialSource *source, source->codec = fs_codec_copy (telephony_codec); + telephony_codec = codec_copy_without_config (telephony_codec); + + telephony_codec->ABI.ABI.ptime = ca->ptime; + telephony_codec->ABI.ABI.maxptime = ca->maxptime; + GST_DEBUG ("Creating dtmf sound source for " FS_CODEC_FORMAT, FS_CODEC_ARGS (telephony_codec)); @@ -271,7 +281,7 @@ fs_rtp_dtmf_sound_source_build (FsRtpSpecialSource *source, goto error; } - caps = fs_codec_to_gst_caps (telephony_codec); + caps = fs_codec_to_gst_caps_with_ptime (telephony_codec); g_object_set (capsfilter, "caps", caps, NULL); { gchar *str = gst_caps_to_string (caps); -- 1.5.6.5 From olivier.crete at collabora.co.uk Tue Jan 5 09:35:38 2010 From: olivier.crete at collabora.co.uk (=?utf-8?q?Olivier=20Cr=C3=AAte?=) Date: Tue, 5 Jan 2010 12:35:38 -0500 Subject: [farsight2/master] Version 0.0.17.1 Message-ID: <20100105173744.B9EE6102B39@dhansak.collabora.co.uk> --- configure.ac | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure.ac b/configure.ac index 8a81632..763e8ef 100644 --- a/configure.ac +++ b/configure.ac @@ -5,7 +5,7 @@ dnl please read gstreamer/docs/random/autotools before changing this file dnl initialize autoconf dnl releases only do -Wall, cvs and prerelease does -Werror too dnl use a three digit version number for releases, and four for cvs/prerelease -AC_INIT(Farsight2, 0.0.17, +AC_INIT(Farsight2, 0.0.17.1, https://bugs.freedesktop.org/enter_bug.cgi?product=Farsight, farsight2) -- 1.5.6.5