From dd8d949bd9547d3f14f67729a857a894e14c0a55 Mon Sep 17 00:00:00 2001 From: Olivier Crete Date: Fri, 13 Jun 2008 23:30:06 +0000 Subject: [PATCH] [MOVED FROM GST-P-FARSIGHT] Take the clock-rate from the caps in rtpdtmfsrc 20080613233006-3e2dc-a7d4e918643f4f8c1bb2cc2678558c654025920e.gz --- gst/dtmf/gstrtpdtmfsrc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gst/dtmf/gstrtpdtmfsrc.c b/gst/dtmf/gstrtpdtmfsrc.c index 76c2b0e77f..58dceb4661 100644 --- a/gst/dtmf/gstrtpdtmfsrc.c +++ b/gst/dtmf/gstrtpdtmfsrc.c @@ -195,7 +195,7 @@ GST_STATIC_PAD_TEMPLATE ("src", "clock-rate = (int) [ 0, MAX ], " "ssrc = (int) [ 0, MAX ], " "encoding-name = (string) \"TELEPHONE-EVENT\"") - /* "events = (string) \"1-16\" */ + /* "events = (string) \"0-15\" */ ); @@ -856,7 +856,6 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc) /* fill in the defaults, there properties cannot be negotiated. */ srccaps = gst_caps_new_simple ("application/x-rtp", "media", G_TYPE_STRING, "audio", - "clock-rate", G_TYPE_INT, dtmfsrc->clock_rate, "encoding-name", G_TYPE_STRING, "TELEPHONE-EVENT", NULL); /* the peer caps can override some of the defaults */ @@ -867,6 +866,7 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc) "payload", G_TYPE_INT, dtmfsrc->pt, "ssrc", G_TYPE_UINT, dtmfsrc->current_ssrc, "clock-base", G_TYPE_UINT, dtmfsrc->ts_base, + "clock-rate", G_TYPE_INT, dtmfsrc->clock_rate, "seqnum-base", G_TYPE_UINT, dtmfsrc->seqnum_base, NULL); GST_DEBUG_OBJECT (dtmfsrc, "no peer caps: %" GST_PTR_FORMAT, srccaps); @@ -875,6 +875,7 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc) GstStructure *s; const GValue *value; gint pt; + gint clock_rate; /* peer provides caps we can use to fixate, intersect. This always returns a * writable caps. */ @@ -919,6 +920,19 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc) } } + if (gst_structure_get_int (s, "clock-rate", &clock_rate)) + { + dtmfsrc->clock_rate = clock_rate; + GST_LOG_OBJECT (dtmfsrc, "using clock-rate from caps %d", + dtmfsrc->clock_rate); + } else { + GST_LOG_OBJECT (dtmfsrc, "using existing clock-rate %d", + dtmfsrc->clock_rate); + } + gst_structure_set (s, "clock-rate", G_TYPE_INT, dtmfsrc->clock_rate, + NULL); + + if (gst_structure_has_field_typed (s, "ssrc", G_TYPE_UINT)) { value = gst_structure_get_value (s, "ssrc"); dtmfsrc->current_ssrc = g_value_get_uint (value);