mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 14:02:26 +00:00
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.
This commit is contained in:
parent
ca2bc1840a
commit
34f916abbd
3 changed files with 32 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
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>
|
2008-05-02 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
Patch by: Olivier Crete <tester at tester dot ca>
|
Patch by: Olivier Crete <tester at tester dot ca>
|
||||||
|
|
|
@ -248,6 +248,7 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||||
|
GST_LOG_OBJECT (depayload, "DISCONT, flushing adapter");
|
||||||
gst_adapter_clear (rtph263pdepay->adapter);
|
gst_adapter_clear (rtph263pdepay->adapter);
|
||||||
rtph263pdepay->wait_start = TRUE;
|
rtph263pdepay->wait_start = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -256,7 +257,6 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
gint payload_len;
|
gint payload_len;
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
gboolean P, V, M;
|
gboolean P, V, M;
|
||||||
guint32 timestamp;
|
|
||||||
guint header_len;
|
guint header_len;
|
||||||
guint8 PLEN, PEBIT;
|
guint8 PLEN, PEBIT;
|
||||||
|
|
||||||
|
@ -281,6 +281,9 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
PLEN = ((payload[0] & 0x1) << 5) | (payload[1] >> 3);
|
PLEN = ((payload[0] & 0x1) << 5) | (payload[1] >> 3);
|
||||||
PEBIT = payload[1] & 0x7;
|
PEBIT = payload[1] & 0x7;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (depayload, "P %d, V %d, PLEN %d, PEBIT %d", P, V, PLEN,
|
||||||
|
PEBIT);
|
||||||
|
|
||||||
if (V) {
|
if (V) {
|
||||||
header_len++;
|
header_len++;
|
||||||
}
|
}
|
||||||
|
@ -292,6 +295,8 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
goto bad_packet;
|
goto bad_packet;
|
||||||
|
|
||||||
if (P) {
|
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;
|
rtph263pdepay->wait_start = FALSE;
|
||||||
header_len -= 2;
|
header_len -= 2;
|
||||||
payload[header_len] = 0;
|
payload[header_len] = 0;
|
||||||
|
@ -301,19 +306,22 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
if (rtph263pdepay->wait_start)
|
if (rtph263pdepay->wait_start)
|
||||||
goto waiting_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 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 */
|
/* FIXME actually use the RTP picture header when it is lost in the network */
|
||||||
/* for now strip off header */
|
/* for now strip off header */
|
||||||
payload += header_len;
|
payload += header_len;
|
||||||
payload_len -= header_len;
|
payload_len -= header_len;
|
||||||
|
|
||||||
timestamp = gst_rtp_buffer_get_timestamp (buf);
|
|
||||||
|
|
||||||
if (M) {
|
if (M) {
|
||||||
/* frame is completed: append to previous, push it out */
|
/* frame is completed: append to previous, push it out */
|
||||||
guint len, padlen;
|
guint len, padlen;
|
||||||
guint avail;
|
guint avail;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (depayload, "Frame complete");
|
||||||
|
|
||||||
avail = gst_adapter_available (rtph263pdepay->adapter);
|
avail = gst_adapter_available (rtph263pdepay->adapter);
|
||||||
|
|
||||||
len = avail + payload_len;
|
len = avail + payload_len;
|
||||||
|
@ -336,6 +344,8 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
/* frame not completed: store in adapter */
|
/* frame not completed: store in adapter */
|
||||||
outbuf = gst_buffer_new_and_alloc (payload_len);
|
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);
|
memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len);
|
||||||
|
|
||||||
gst_adapter_push (rtph263pdepay->adapter, outbuf);
|
gst_adapter_push (rtph263pdepay->adapter, outbuf);
|
||||||
|
@ -349,6 +359,12 @@ bad_packet:
|
||||||
("Packet did not validate"), (NULL));
|
("Packet did not validate"), (NULL));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
too_small:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
|
||||||
|
("Packet payload was too small"), (NULL));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
waiting_start:
|
waiting_start:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (rtph263pdepay, "waiting for picture start");
|
GST_DEBUG_OBJECT (rtph263pdepay, "waiting for picture start");
|
||||||
|
|
|
@ -141,6 +141,7 @@ gst_rtp_pcmu_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstBuffer *outbuf = NULL;
|
GstBuffer *outbuf = NULL;
|
||||||
|
guint len;
|
||||||
|
|
||||||
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
||||||
GST_BUFFER_SIZE (buf),
|
GST_BUFFER_SIZE (buf),
|
||||||
|
@ -156,8 +157,12 @@ gst_rtp_pcmu_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
outbuf = gst_rtp_buffer_get_payload_buffer (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;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue