mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
gst-libs/gst/rtp/gstbasertpdepayload.c: Don't assert when not negotiated but post a meaningfull error message. Fixes ...
Original commit message from CVS: * gst-libs/gst/rtp/gstbasertpdepayload.c: (gst_base_rtp_depayload_chain), (gst_base_rtp_depayload_change_state): Don't assert when not negotiated but post a meaningfull error message. Fixes #347918. * gst-libs/gst/rtp/gstbasertppayload.c: Add comment about better default MTU size. * gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtp_buffer_validate_data): Small cleanups, start docs.
This commit is contained in:
parent
5a274b64d1
commit
01402bc9e3
4 changed files with 69 additions and 12 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2006-07-19 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst-libs/gst/rtp/gstbasertpdepayload.c:
|
||||
(gst_base_rtp_depayload_chain),
|
||||
(gst_base_rtp_depayload_change_state):
|
||||
Don't assert when not negotiated but post a meaningfull
|
||||
error message. Fixes #347918.
|
||||
|
||||
* gst-libs/gst/rtp/gstbasertppayload.c:
|
||||
Add comment about better default MTU size.
|
||||
|
||||
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtp_buffer_validate_data):
|
||||
Small cleanups, start docs.
|
||||
|
||||
2006-07-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
Patch by: Martin Szulecki
|
||||
|
|
|
@ -205,7 +205,8 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
|
|||
|
||||
filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
|
||||
|
||||
g_return_val_if_fail (filter->clock_rate > 0, GST_FLOW_ERROR);
|
||||
if (filter->clock_rate <= 0)
|
||||
goto not_configured;
|
||||
|
||||
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
||||
|
||||
|
@ -217,6 +218,14 @@ gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
|
|||
ret = bclass->add_to_queue (filter, in);
|
||||
}
|
||||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
not_configured:
|
||||
{
|
||||
GST_ELEMENT_ERROR (filter, STREAM, FORMAT,
|
||||
(NULL), ("no clock rate was specified, likely incomplete input caps"));
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
@ -32,6 +32,12 @@ enum
|
|||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
/* FIXME 0.11, a better default is the Ethernet MTU of
|
||||
* 1500 - sizeof(headers) as pointed out by marcelm in IRC:
|
||||
* So an Ethernet MTU of 1500, minus 60 for the max IP, minus 8 for UDP, gives
|
||||
* 1432 bytes or so. And that should be adjusted downward further for other
|
||||
* encapsulations like PPPoE, so 1400 at most.
|
||||
*/
|
||||
#define DEFAULT_MTU 1024
|
||||
#define DEFAULT_PT 96
|
||||
#define DEFAULT_SSRC -1
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
|
||||
* Copyright (C) <2006> Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -17,6 +18,22 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:gstrtpbuffer
|
||||
* @short_description: Helper methods for dealing with RTP buffers
|
||||
* @see_also: gstbasertppayload, gstbasertpdepayload
|
||||
*
|
||||
* <refsect2>
|
||||
* <para>
|
||||
* The GstRTPBuffer helper functions makes it easy to parse and create regular
|
||||
* #GstBuffer objects that contain RTP payloads. These buffers are typically of
|
||||
* 'application/x-rtp' #GstCaps.
|
||||
* </para>
|
||||
* </refsect2>
|
||||
*
|
||||
* Last reviewed on 2006-07-17 (0.10.10)
|
||||
*/
|
||||
|
||||
#include "gstrtpbuffer.h"
|
||||
|
||||
#define GST_RTP_HEADER_LEN 12
|
||||
|
@ -176,17 +193,13 @@ gst_rtp_buffer_validate_data (guint8 * data, guint len)
|
|||
g_return_val_if_fail (data != NULL, FALSE);
|
||||
|
||||
header_len = GST_RTP_HEADER_LEN;
|
||||
if (len < header_len) {
|
||||
GST_DEBUG ("len < header_len check failed (%d < %d)", len, header_len);
|
||||
return FALSE;
|
||||
}
|
||||
if (G_UNLIKELY (len < header_len))
|
||||
goto wrong_length;
|
||||
|
||||
/* check version */
|
||||
version = (data[0] & 0xc0) >> 6;
|
||||
if (version != GST_RTP_VERSION) {
|
||||
GST_DEBUG ("version check failed (%d != %d)", version, GST_RTP_VERSION);
|
||||
return FALSE;
|
||||
}
|
||||
if (G_UNLIKELY (version != GST_RTP_VERSION))
|
||||
goto wrong_version;
|
||||
|
||||
/* calc header length with csrc */
|
||||
csrc_count = (data[0] & 0x0f);
|
||||
|
@ -199,13 +212,28 @@ gst_rtp_buffer_validate_data (guint8 * data, guint len)
|
|||
padding = 0;
|
||||
|
||||
/* check if padding not bigger than packet and header */
|
||||
if (len - header_len <= padding) {
|
||||
if (G_UNLIKELY (len - header_len <= padding))
|
||||
goto wrong_padding;
|
||||
|
||||
return TRUE;
|
||||
|
||||
/* ERRORS */
|
||||
wrong_length:
|
||||
{
|
||||
GST_DEBUG ("len < header_len check failed (%d < %d)", len, header_len);
|
||||
return FALSE;
|
||||
}
|
||||
wrong_version:
|
||||
{
|
||||
GST_DEBUG ("version check failed (%d != %d)", version, GST_RTP_VERSION);
|
||||
return FALSE;
|
||||
}
|
||||
wrong_padding:
|
||||
{
|
||||
GST_DEBUG ("padding check failed (%d - %d <= %d)",
|
||||
len, header_len, padding);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
Loading…
Reference in a new issue