diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-12-29 14:21:47 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2009-08-11 02:30:40 +0100 |
commit | 3fe87f7eab5982f2326e95d868d01fb1bc7a00f5 (patch) | |
tree | d976c2b677681e3563384c097f485a3d5115494c /gst/rtpmanager/rtpsource.c | |
parent | 2142edd3991bd9f41e4082588fa9a6f351e6b68a (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/rtpsource.c')
-rw-r--r-- | gst/rtpmanager/rtpsource.c | 20 |
1 files changed, 17 insertions, 3 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; |