mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
udpsink: warn when packet is too large
This commit is contained in:
parent
e017e14847
commit
053f03c032
1 changed files with 12 additions and 0 deletions
|
@ -44,6 +44,8 @@
|
||||||
GST_DEBUG_CATEGORY_STATIC (multiudpsink_debug);
|
GST_DEBUG_CATEGORY_STATIC (multiudpsink_debug);
|
||||||
#define GST_CAT_DEFAULT (multiudpsink_debug)
|
#define GST_CAT_DEFAULT (multiudpsink_debug)
|
||||||
|
|
||||||
|
#define UDP_MAX_SIZE 65507
|
||||||
|
|
||||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
|
@ -496,6 +498,11 @@ gst_multiudpsink_render (GstBaseSink * bsink, GstBuffer * buffer)
|
||||||
size = GST_BUFFER_SIZE (buffer);
|
size = GST_BUFFER_SIZE (buffer);
|
||||||
data = GST_BUFFER_DATA (buffer);
|
data = GST_BUFFER_DATA (buffer);
|
||||||
|
|
||||||
|
if (size > UDP_MAX_SIZE) {
|
||||||
|
GST_WARNING ("Attempting to send a UDP packet larger than maximum "
|
||||||
|
"size (%d > %d)", size, UDP_MAX_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
sink->bytes_to_serve += size;
|
sink->bytes_to_serve += size;
|
||||||
|
|
||||||
/* grab lock while iterating and sending to clients, this should be
|
/* grab lock while iterating and sending to clients, this should be
|
||||||
|
@ -586,6 +593,11 @@ gst_multiudpsink_render_list (GstBaseSink * bsink, GstBufferList * list)
|
||||||
msg.msg_iov = iov;
|
msg.msg_iov = iov;
|
||||||
|
|
||||||
while ((buf = gst_buffer_list_iterator_next (it))) {
|
while ((buf = gst_buffer_list_iterator_next (it))) {
|
||||||
|
if (GST_BUFFER_SIZE (buf) > UDP_MAX_SIZE) {
|
||||||
|
GST_WARNING ("Attempting to send a UDP packet larger than maximum "
|
||||||
|
"size (%d > %d)", GST_BUFFER_SIZE (buf), UDP_MAX_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
msg.msg_iov[msg.msg_iovlen].iov_len = GST_BUFFER_SIZE (buf);
|
msg.msg_iov[msg.msg_iovlen].iov_len = GST_BUFFER_SIZE (buf);
|
||||||
msg.msg_iov[msg.msg_iovlen].iov_base = GST_BUFFER_DATA (buf);
|
msg.msg_iov[msg.msg_iovlen].iov_base = GST_BUFFER_DATA (buf);
|
||||||
msg.msg_iovlen++;
|
msg.msg_iovlen++;
|
||||||
|
|
Loading…
Reference in a new issue