summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-12-29 14:21:47 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-11 02:30:40 +0100
commit3fe87f7eab5982f2326e95d868d01fb1bc7a00f5 (patch)
treed976c2b677681e3563384c097f485a3d5115494c /gst/rtpmanager
parent2142edd3991bd9f41e4082588fa9a6f351e6b68a (diff)
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.
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r--gst/rtpmanager/rtpsource.c20
-rw-r--r--gst/rtpmanager/rtpsource.h2
2 files changed, 18 insertions, 4 deletions
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index 5aff0054..4fae901e 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 0353a58b..a44ac1cd 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;