Commit graph

357 commits

Author SHA1 Message Date
Sanjay NM
66810a32f6 udp: include string.h for memcmp and memset
https://bugzilla.gnome.org//show_bug.cgi?id=736528
2014-09-12 10:45:39 +01:00
Tim-Philipp Müller
e6f77948ac udpsrc: more efficient memory handling
Drop use of g_socket_get_available_bytes() which is
not useful on all systems (where it returns the size
of the entire buffer not that of the next pending
packet), and is yet another syscall and apparently
very inefficient on Windows in the UDP case.

Instead, when reading UDP packets, use the more featureful
g_socket_receive_message() call that allows to read into
scattered memory, and allocate one memory chunk which is
likely to be large enough for a packet, while also providing
a larger allocated memory chunk just in case the packet
is larger than expected. If the received data fits into the
first chunk, we'll just add that to the buffer we return
and re-use the fallback buffer for next time, otherwise we
add both chunks to the buffer.

This reduces memory waste more reliably on systems where
get_available_bytes() doesn't work properly.

In a multimedia streaming scenario, incoming UDP packets
are almost never fragmented and thus almost always smaller
than the MTU size, which is also why we don't try to do
something smarter with more fallback memory chunks of
different sizes. The fallback scenario is just for when
someone built a broken sender pipeline (not using a
payloader or somesuch)

https://bugzilla.gnome.org/show_bug.cgi?id=610364
2014-09-09 17:38:52 +01:00
Tim-Philipp Müller
39505584e1 udpsrc: rework memory allocation bits and ensure we always have two chunks of memories to read into
First chunk is the likely/expected buffer size, second is as
fallback in case the packet is larger in the end.

Next step: actually use these.
2014-09-09 17:35:38 +01:00
Tim-Philipp Müller
305e4c2f46 udpsrc: track max packet size and save allocator negotiated by GstBaseSrc 2014-09-09 17:35:14 +01:00
Víctor Manuel Jáquez Leal
419332e287 udp: fix udpsrc documentation
udpsrc gtk-doc documentation refers to sockfd and closefd properties which has
been removed. This patch replaces those references to socket and close-socket
respectively.

https://bugzilla.gnome.org/show_bug.cgi?id=734987
2014-08-18 11:01:31 +01:00
Tim-Philipp Müller
41c895de4d multiudpsink: optimisation: avoid unnecessary memory ref/unrefs
We know the buffer will stay valid and we will also not
modify the buffer, we just want to send out the data.
2014-06-20 12:21:05 +01:00
Tim-Philipp Müller
3512ad3be0 multiudpsink: avoid some unnecessary run-time type checks 2014-06-20 12:06:57 +01:00
Tim-Philipp Müller
884d1af074 udp: improve element descriptions for dynudpsink and multiudpsink 2014-06-18 14:54:58 +01:00
Tim-Philipp Müller
6c1231eed3 udp: remove suppression of compiler warnings for deprecated GLib API
Not needed any more.
2014-06-18 14:54:58 +01:00
Tim-Philipp Müller
bb51ec5842 dynudpsink: return FLUSHING when sendto got canceled, not an error 2014-06-13 10:12:07 +01:00
Tim-Philipp Müller
c9597298f9 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:35:17 +01:00
Vincent Penquerc'h
25fa88f8aa multiidpsink: warn when setsockopt fails
This doesn't seem to be fatal, but it's good to let the user know
in the logs.

Coverity 1139630
2014-04-21 17:21:20 +01:00
Marc Leeman
5b4681dfe7 udpsrc: correct LOG msg for -1
Signed-off-by: Marc Leeman <marc.leeman@gmail.com>
2014-04-16 13:54:40 +01:00
Wim Taymans
d3c736c50f udpsrc: improve caps handling
Protect caps with the lock.
Don't push the caps event from the set_property function but mark the
pad for reconfiguration so that it will renegotiate and push the new
caps event in the streaming thread.
2014-03-24 15:22:04 +01:00
Wim Taymans
5e44fa3e31 udpsrc: open/close socket in NULL<->READY state
We should open the socket when going to NULL<->READY and not in the
start/stop vemthod, which is called in READY<->PAUSED. This makes it
possible to allocate a socket without going to PAUSED (and starting the
negotiation).
2014-03-24 15:15:34 +01:00
William Jon McCann
577d873009 docs: fix mismatched para tags
newer gtkdoc is more sensitive to mismatched docbook tags.
This fixes the build in master.
2014-02-14 22:26:08 +01:00
Tim-Philipp Müller
9c9efffd8c udpsrc: on receive error only unmap and unref buffer if one was alloced and mapped
coverity CID 1139866.
2013-12-19 20:35:03 +00:00
Tim-Philipp Müller
627109ce4d multiudpsink: fix misleading comment
Those are not allocated on the stack.
2013-12-19 12:47:22 +00:00
Tim-Philipp Müller
d506409af5 docs: get rid of 'Since: 0.10.x' markers
And some gtk-doc markup fixes.
2013-11-18 14:47:35 +00:00
Sebastian Dröge
fd89e36c8a multiudpsink: Also use the bind-port property if no bind-address was given 2013-11-07 09:50:39 +01:00
Ognyan Tonchev
c81ce6b152 multiudpsink: Fix memory leak
Unmap all GstMemory of the current buffer when flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=710110
2013-10-14 18:21:54 +02:00
Tim-Philipp Müller
60e72b0254 udpsrc: fix build on win32
gstudpsrc.c:855:15: error: #if with no expression
2013-09-05 19:46:37 +01:00
Sebastian Dröge
7f59436979 udpsrc: Bind to multicast addresses on non-Windows systems
On Windows it's not possible to bind to a multicast address
but the OS will make sure to filter out all packets that
arrive not for the multicast address the socket joined.

On Linux and others it is necessary to bind to a multicast
address to let the OS filter out all packets that are received
on the same port but for different addresses than the multicast
address

And deprecate the multicast-group property and replace it with the
address property.

https://bugzilla.gnome.org/show_bug.cgi?id=707042
2013-09-03 11:23:24 +02:00
Sebastian Dröge
edf6d28765 udpsrc: Refactor address resolval into its own function 2013-09-03 10:10:49 +02:00
Tim-Philipp Müller
fe098e3aff udp: remove unused marshal and enumtypes files 2013-08-04 11:03:07 +01:00
Wim Taymans
35f6e79b94 udpsink: bind to the given interface
Actually call BINDTODEVICE to bind to the interface as given by the
property.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702819
2013-06-24 17:13:05 +02:00
Wim Taymans
0d27829a6b udpsink: avoid leaking the host
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=701586
2013-06-05 12:14:01 +02:00
Sebastian Dröge
e26b8c2832 (dyn|multi)udpsink: Add properties to specify the bind address and port
By default we use the any addresses and a random port for binding the socket.
2013-05-23 18:42:09 +02:00
Sebastian Dröge
5b79b8ff3c (dyn|multi)udpsink: Bind socket before using it
https://bugzilla.gnome.org/show_bug.cgi?id=700878
2013-05-23 18:05:07 +02:00
Sebastian Dröge
1ed7f7a6a8 (multi)udpsink: Add missing getters for socket-v6 and used-socket-v6 properties 2013-05-23 17:26:31 +02:00
Tim-Philipp Müller
7ccb387e85 udp: log WARNING debug message if UDP multicast is likely to be broken 2013-04-27 11:25:12 +01:00
Tim-Philipp Müller
4273eccace udpsrc: add includes to get socklen_t defined on Windows
https://bugzilla.gnome.org/show_bug.cgi?id=692400
2013-04-27 11:16:54 +01:00
Sebastian Dröge
b1af93f791 (multi)udpsink: Use separate sockets for IPv4 and IPv6
https://bugzilla.gnome.org/show_bug.cgi?id=534243
2013-04-25 12:12:23 +02:00
Sebastian Dröge
0b552150ce dynudpsink: Use separate sockets for IPv4 and IPv6
https://bugzilla.gnome.org/show_bug.cgi?id=534243
2013-04-25 12:09:27 +02:00
Sebastian Dröge
ed8ea46424 udp: Don't include removed gstudp.h in noinst_HEADERS 2013-04-25 10:43:56 +02:00
Sebastian Dröge
afb284e3a9 udp: Remove unused enum type 2013-04-25 09:16:14 +02:00
Sebastian Dröge
a957457cc1 udp: Use the generic marshaller instead of generating marshallers 2013-04-25 09:13:51 +02:00
Sebastian Dröge
07d3363436 udpsrc: Rename instance variable from host to multi_group
This is more consistent as it's used for the multicast-group property.
2013-04-25 09:07:41 +02:00
Sebastian Dröge
427673d283 udpsrc: Add bind-address property
This is equivalent to multicast-group currently for backwards compatibility.
In 2.0 this should be handled separately, the former only being the multicast
group and the latter always being the address the socket is bound to, even if
a multicast group is given.
2013-04-25 09:05:12 +02:00
Sebastian Dröge
b0b0557c48 gst: Add better support for static plugins 2013-04-15 15:54:11 +02:00
Wim Taymans
f96aa414e1 udpsink: avoid alloc and free in render function
Avoid doing alloc and free in the render function for each buffer. Instead,
allocate the needed arrays in _init and use those.
2013-04-11 14:57:11 +01:00
Wim Taymans
3d7d757521 udpsink: improve debug 2013-04-09 16:53:31 +02:00
Tim-Philipp Müller
01c6512d5f udpsrc: use g_socket_set_option() to set buffer size with newer GLib versions
So we have to worry less about portability.

https://bugzilla.gnome.org/show_bug.cgi?id=692400
2013-02-15 14:11:36 +00:00
Tim-Philipp Müller
cf1f6aff0d udpsrc: sanity check size of available packet data for reading to avoid memory waste
On Windows and OS/X, _get_available_bytes() may not return the size
of the next pending packet, but the size of all pending packets in
the kernel-side buffer, which might be rather large depending on
configuration. Sanity-check the size returned by _get_available_bytes()
to make sure we never allocate more memory than the max. size for
a packet, if it's an IPv4 socket.

https://bugzilla.gnome.org/show_bug.cgi?id=610364
2013-01-04 14:00:55 +00:00
Wim Taymans
32bd981303 udpsrc: improve timeouts
Make it possible to set the timeout after we went to the READY state by using
the timeout when checking the condition. This also makes it possible to set the
timeout with a higher granularity than seconds.
2012-12-12 11:08:13 +01:00
Wim Taymans
c33507f186 udpsrc: post error before stopping 2012-11-15 14:48:59 +01:00
Sebastian Dröge
c70ba7765a udpsrc: Also clear GError 2012-11-09 11:22:30 +01:00
Sebastian Dröge
b86d20e45b udpsrc: Don't error out if we get an ICMP destination-unreachable message when trying to read packets
See bug #529454 and #687782 and commit
751f2bb364
2012-11-09 11:20:27 +01:00
Tim-Philipp Müller
230cf41cc9 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:07:18 +00:00
Sebastian Rasmussen
9fc62a58e3 updsrc: fix typo causing compilation error
gstudpsrc.c: In function 'gst_udpsrc_create':
gstudpsrc.c:365: error: 'ret' may be used uninitialized in this function

https://bugzilla.gnome.org/show_bug.cgi?id=686642
2012-10-22 23:19:28 +01:00