diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-05-02 12:44:18 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-05-02 12:44:18 +0000 |
commit | 34f916abbd9284552603810e3a0d4abf3e831dbd (patch) | |
tree | 1e50b288f260a6a97f88b42bffae62e3eda6f394 | |
parent | ca2bc1840a53ad7eba34177cfb23bc75f244e9b8 (diff) |
gst/rtp/gstrtph263pdepay.c: Add some more debug info and guard against small payloads.
Original commit message from CVS:
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_process):
Add some more debug info and guard against small payloads.
* gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_process):
Set duration on outgoing buffers because we can.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | gst/rtp/gstrtph263pdepay.c | 22 | ||||
-rw-r--r-- | gst/rtp/gstrtppcmudepay.c | 5 |
3 files changed, 32 insertions, 3 deletions
@@ -1,5 +1,13 @@ 2008-05-02 Wim Taymans <wim.taymans@collabora.co.uk> + * gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_process): + Add some more debug info and guard against small payloads. + + * gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_process): + Set duration on outgoing buffers because we can. + +2008-05-02 Wim Taymans <wim.taymans@collabora.co.uk> + Patch by: Olivier Crete <tester at tester dot ca> * ext/speex/gstspeexenc.c: (gst_speex_enc_sink_getcaps), diff --git a/gst/rtp/gstrtph263pdepay.c b/gst/rtp/gstrtph263pdepay.c index da25acc5..97f06845 100644 --- a/gst/rtp/gstrtph263pdepay.c +++ b/gst/rtp/gstrtph263pdepay.c @@ -248,6 +248,7 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) /* flush remaining data on discont */ if (GST_BUFFER_IS_DISCONT (buf)) { + GST_LOG_OBJECT (depayload, "DISCONT, flushing adapter"); gst_adapter_clear (rtph263pdepay->adapter); rtph263pdepay->wait_start = TRUE; } @@ -256,7 +257,6 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) gint payload_len; guint8 *payload; gboolean P, V, M; - guint32 timestamp; guint header_len; guint8 PLEN, PEBIT; @@ -281,6 +281,9 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) PLEN = ((payload[0] & 0x1) << 5) | (payload[1] >> 3); PEBIT = payload[1] & 0x7; + GST_LOG_OBJECT (depayload, "P %d, V %d, PLEN %d, PEBIT %d", P, V, PLEN, + PEBIT); + if (V) { header_len++; } @@ -292,6 +295,8 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) goto bad_packet; if (P) { + /* FIXME, have to make the packet writable hear. Better to reset these + * bytes when we copy the packet below */ rtph263pdepay->wait_start = FALSE; header_len -= 2; payload[header_len] = 0; @@ -301,19 +306,22 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) if (rtph263pdepay->wait_start) goto waiting_start; + if (payload_len < header_len) + goto too_small; + /* FIXME do not ignore the VRC header (See RFC 2429 section 4.2) */ /* FIXME actually use the RTP picture header when it is lost in the network */ /* for now strip off header */ payload += header_len; payload_len -= header_len; - timestamp = gst_rtp_buffer_get_timestamp (buf); - if (M) { /* frame is completed: append to previous, push it out */ guint len, padlen; guint avail; + GST_LOG_OBJECT (depayload, "Frame complete"); + avail = gst_adapter_available (rtph263pdepay->adapter); len = avail + payload_len; @@ -336,6 +344,8 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) /* frame not completed: store in adapter */ outbuf = gst_buffer_new_and_alloc (payload_len); + GST_LOG_OBJECT (depayload, "Frame incomplete, storing %d", payload_len); + memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len); gst_adapter_push (rtph263pdepay->adapter, outbuf); @@ -349,6 +359,12 @@ bad_packet: ("Packet did not validate"), (NULL)); return NULL; } +too_small: + { + GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE, + ("Packet payload was too small"), (NULL)); + return NULL; + } waiting_start: { GST_DEBUG_OBJECT (rtph263pdepay, "waiting for picture start"); diff --git a/gst/rtp/gstrtppcmudepay.c b/gst/rtp/gstrtppcmudepay.c index b472e89d..2f0ec550 100644 --- a/gst/rtp/gstrtppcmudepay.c +++ b/gst/rtp/gstrtppcmudepay.c @@ -141,6 +141,7 @@ gst_rtp_pcmu_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) { GstCaps *srccaps; GstBuffer *outbuf = NULL; + guint len; GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d", GST_BUFFER_SIZE (buf), @@ -156,8 +157,12 @@ gst_rtp_pcmu_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) gst_caps_unref (srccaps); } + len = gst_rtp_buffer_get_payload_len (buf); outbuf = gst_rtp_buffer_get_payload_buffer (buf); + GST_BUFFER_DURATION (outbuf) = + gst_util_uint64_scale_int (len, GST_SECOND, depayload->clock_rate); + return outbuf; } |