summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-12-29 14:21:47 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-12-29 14:21:47 +0000
commitb4a20d3a308c5a6102ee45336a5eca368b9f6314 (patch)
tree6875fdf831321155457bc123be6ec37fe964590b
parent363a7b761c7bad498745488fbc20676b96e5a5a3 (diff)
downloadgstreamer-plugins-bad-b4a20d3a308c5a6102ee45336a5eca368b9f6314.tar.gz
gst/rtpmanager/rtpsource.*: When no payload was specified on the caps but there was a clock-rate, assume the clock-ra...
Original commit message from CVS: * gst/rtpmanager/rtpsource.c: (rtp_source_init), (rtp_source_update_caps), (get_clock_rate): * gst/rtpmanager/rtpsource.h: When no payload was specified on the caps but there was a clock-rate, assume the clock-rate corresponds to the first payload type found in the RTP packets. Fixes #565509.
-rw-r--r--ChangeLog9
-rw-r--r--gst/rtpmanager/rtpsource.c20
-rw-r--r--gst/rtpmanager/rtpsource.h2
3 files changed, 27 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 7057236fc..2846b84ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-29 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ * gst/rtpmanager/rtpsource.c: (rtp_source_init),
+ (rtp_source_update_caps), (get_clock_rate):
+ * gst/rtpmanager/rtpsource.h:
+ When no payload was specified on the caps but there was a clock-rate,
+ assume the clock-rate corresponds to the first payload type found in the
+ RTP packets. Fixes #565509.
+
2008-12-23 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/dvb/gstdvbsrc.c:
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 5aff00540..4fae901ec 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -156,7 +156,7 @@ rtp_source_init (RTPSource * src)
src->internal = FALSE;
src->probation = RTP_DEFAULT_PROBATION;
- src->payload = 0;
+ src->payload = -1;
src->clock_rate = -1;
src->packets = g_queue_new ();
src->seqnum_base = -1;
@@ -575,13 +575,22 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps)
if (gst_structure_get_int (s, "payload", &ival))
src->payload = ival;
+ else
+ src->payload = -1;
GST_DEBUG ("got payload %d", src->payload);
- gst_structure_get_int (s, "clock-rate", &src->clock_rate);
+ if (gst_structure_get_int (s, "clock-rate", &ival))
+ src->clock_rate = ival;
+ else
+ src->clock_rate = -1;
+
GST_DEBUG ("got clock-rate %d", src->clock_rate);
if (gst_structure_get_uint (s, "seqnum-base", &val))
src->seqnum_base = val;
+ else
+ src->seqnum_base = -1;
+
GST_DEBUG ("got seqnum-base %" G_GINT32_FORMAT, src->seqnum_base);
gst_caps_replace (&src->caps, caps);
@@ -776,7 +785,12 @@ push_packet (RTPSource * src, GstBuffer * buffer)
static gint
get_clock_rate (RTPSource * src, guint8 payload)
{
- if (payload != src->payload) {
+ if (src->payload == -1) {
+ /* first payload received, nothing was in the caps, lock on to this payload */
+ src->payload = payload;
+ GST_DEBUG ("first payload %d", payload);
+ } else if (payload != src->payload) {
+ /* we have a different payload than before, reset the clock-rate */
GST_DEBUG ("new payload %d", payload);
src->payload = payload;
src->clock_rate = -1;
diff --git a/gst/rtpmanager/rtpsource.h b/gst/rtpmanager/rtpsource.h
index 0353a58b3..a44ac1cdb 100644
--- a/gst/rtpmanager/rtpsource.h
+++ b/gst/rtpmanager/rtpsource.h
@@ -128,7 +128,7 @@ struct _RTPSource {
gboolean have_rtcp_from;
GstNetAddress rtcp_from;
- guint8 payload;
+ gint payload;
GstCaps *caps;
gint clock_rate;
gint32 seqnum_base;