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.
This commit is contained in:
Wim Taymans 2008-12-29 14:21:47 +00:00 committed by Tim-Philipp Müller
parent 2142edd399
commit 3fe87f7eab
2 changed files with 18 additions and 4 deletions

View file

@ -156,7 +156,7 @@ rtp_source_init (RTPSource * src)
src->internal = FALSE; src->internal = FALSE;
src->probation = RTP_DEFAULT_PROBATION; src->probation = RTP_DEFAULT_PROBATION;
src->payload = 0; src->payload = -1;
src->clock_rate = -1; src->clock_rate = -1;
src->packets = g_queue_new (); src->packets = g_queue_new ();
src->seqnum_base = -1; src->seqnum_base = -1;
@ -575,13 +575,22 @@ rtp_source_update_caps (RTPSource * src, GstCaps * caps)
if (gst_structure_get_int (s, "payload", &ival)) if (gst_structure_get_int (s, "payload", &ival))
src->payload = ival; src->payload = ival;
else
src->payload = -1;
GST_DEBUG ("got payload %d", src->payload); 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); GST_DEBUG ("got clock-rate %d", src->clock_rate);
if (gst_structure_get_uint (s, "seqnum-base", &val)) if (gst_structure_get_uint (s, "seqnum-base", &val))
src->seqnum_base = val; src->seqnum_base = val;
else
src->seqnum_base = -1;
GST_DEBUG ("got seqnum-base %" G_GINT32_FORMAT, src->seqnum_base); GST_DEBUG ("got seqnum-base %" G_GINT32_FORMAT, src->seqnum_base);
gst_caps_replace (&src->caps, caps); gst_caps_replace (&src->caps, caps);
@ -776,7 +785,12 @@ push_packet (RTPSource * src, GstBuffer * buffer)
static gint static gint
get_clock_rate (RTPSource * src, guint8 payload) 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); GST_DEBUG ("new payload %d", payload);
src->payload = payload; src->payload = payload;
src->clock_rate = -1; src->clock_rate = -1;

View file

@ -128,7 +128,7 @@ struct _RTPSource {
gboolean have_rtcp_from; gboolean have_rtcp_from;
GstNetAddress rtcp_from; GstNetAddress rtcp_from;
guint8 payload; gint payload;
GstCaps *caps; GstCaps *caps;
gint clock_rate; gint clock_rate;
gint32 seqnum_base; gint32 seqnum_base;