Commit graph

389 commits

Author SHA1 Message Date
Tim-Philipp Müller
0686174f19 udpsrc: fix Since version for new "loop" property 2016-05-18 18:35:27 +01:00
Tim-Philipp Müller
21e281feea udpsrc: add doc blurb with since marker for new "loop" property 2016-05-17 05:33:35 +01:00
Sebastian Dröge
3b7df52c86 udpsrc: Always bind to ANY when address is a multicast address and not only on Windows
For IPv6 addresses, binding to a multicast group does not work on Linux
either. Always bind to ANY and then later join the multicast group.

https://bugzilla.gnome.org/show_bug.cgi?id=764679
2016-04-29 11:48:23 +03:00
Mats Lindestam
63c284c24e multiudpsink: Allow setting "socket-v6" without setting "socket" too
https://bugzilla.gnome.org/show_bug.cgi?id=764897
2016-04-26 11:05:22 +03:00
Tim-Philipp Müller
76506190e9 udpsrc: add "retrieve-sender-address" property
This allows disabling of sender address retrieval, which might
be useful in certain scenarios, like when the socket is connected,
or the sender address is not of interest (e.g. when receiving an
MPEG-TS stream). Disabling sender address retrieval in those
cases can have minor performance advantages.

https://bugzilla.gnome.org/show_bug.cgi?id=563323
2016-04-18 14:33:10 +01:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Sebastian Dröge
49be64e571 udpsrc: Fix multicast group joining with provided sockets on Windows
On Windows the socket will be bound to ANY instead of the multicast group,
as binding to a multicast group does not work. Which would mean that we
override src->addr to become ANY and won't automatically join a multicast
group anymore on Windows.

On Linux we would automatically join a multicast group, keep it consistent.

https://bugzilla.gnome.org/show_bug.cgi?id=763093
2016-03-04 15:31:51 +02:00
Tim-Philipp Müller
13a9a7543d win32: remove outdated build cruft
This hasn't been touched for generations, doesn't work,
and is just causing confusion. We also don't want to
maintain these files manually.
2016-02-21 09:47:43 +00:00
Sebastian Dröge
ffd3b391c8 udpsrc: Add "loop" property for enabling/disabling multicast loopback
On POSIX, IP_MULTICAST_LOOP is a setting for the sender socket. On Windows it
is a setting for the receiver socket. As such we will need it on udpsrc too to
allow filtering out our own multicast packets.
2015-11-17 12:39:05 +02:00
Mischa Spiegelmock
cdd7091c1c docs: Minor fixes in various places
https://bugzilla.gnome.org/show_bug.cgi?id=756996
2015-10-23 10:42:19 +03:00
Sebastian Dröge
41a82b9706 udpsrc: Fixup last commit 2015-10-02 22:42:20 +03:00
Sebastian Dröge
26588fbdb3 Update GLib dependency to 2.40.0 2015-10-02 22:21:45 +03:00
Vineeth TM
2a7ba2955c multiudpsink: fix GError memory leak when hostname resolution fails
https://bugzilla.gnome.org/show_bug.cgi?id=754869
2015-09-11 10:18:14 +01:00
Sebastian Dröge
50e9cc7f04 udpsrc: Fix build with GLib < 2.44
G_IO_ERROR_CONNECTION_CLOSED was added in 2.44.
2015-09-04 15:18:05 +03:00
Sebastian Dröge
89137fc136 udpsrc: Ignore G_IO_ERROR_CONNECTION_CLOSED when receiving data
This happens on Windows if we use the same socket for sending packets,
and the remote sends ICMP port/host unreachable messages.

https://bugzilla.gnome.org/show_bug.cgi?id=754534
2015-09-04 12:01:52 +03:00
Tim-Philipp Müller
2e5df10ed9 dynudpsink: keep GCancellable fd around instead of re-creating it constantly
And create it only when starting the element.
2015-05-27 17:08:47 +01:00
Tim-Philipp Müller
b33d30621c udpsink, multiudpsink: keep GCancellable fd around instead of re-creating it constantly
Otherwise we constantly create/close event file descriptors,
every time we call g_socket_condition_timed_wait() or
g_socket_send_message(s)(), i.e. a lot. Which is not
particularly good for performance.

Can't create GCancellable in ::start() here because it's used
in client_new() which may be called via the add-client action
signal which may be called before the element is up and running.
2015-05-27 17:08:47 +01:00
Tim-Philipp Müller
11bb21f3c2 udpsrc: keep GCancellable fd around instead of re-creating it constantly
Otherwise we constantly create/close event file descriptors,
every single time we call g_socket_condition_timed_wait() or
g_socket_receive_message(), i.e. twice per packet received!
This was not particularly good for performance.

Also only create GCancellable on start-up.
2015-05-27 17:08:47 +01:00
Tim-Philipp Müller
f54110fd3e udp: don't use soon-to-be-deprecated g_cancellable_reset()
From the API documentation: "Note that it is generally not
a good idea to reuse an existing cancellable for more
operations after it has been cancelled once, as this
function might tempt you to do. The recommended practice
is to drop the reference to a cancellable after cancelling
it, and let it die with the outstanding async operations.
You should create a fresh cancellable for further async
operations."

https://bugzilla.gnome.org/show_bug.cgi?id=739132
2015-05-19 19:00:20 +01:00
Tim-Philipp Müller
d753a3eeb1 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 17:55:07 +01:00
Luis de Bethencourt
671b4d25cd remove unused enum items PROP_LAST
This were probably added to the enums due to cargo cult programming and are
unused. Removing them.
2015-04-24 17:01:12 +01:00
Tim-Philipp Müller
3c595f308a multiudpsink: fix crash with GST_DEBUG enabled
g_inet_socket_address_get_address() does not give
us a ref to the address, so don't unref it.
2015-03-13 18:38:42 +00:00
Tim-Philipp Müller
c4fa54da17 Fix double semicolons 2015-03-10 09:31:20 +00:00
Tim-Philipp Müller
4dd7d79b52 udpsink: allocate scratch space for render functions on the heap
and not the stack. Our allocations could get a bit too large
to be sure it's not going to cause trouble using the stack.
2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
97a2eb7afb multiudpsink: re-use send_buffers() code path for render() function
It's like rendering a buffer list, just with one buffer.
Has the added advantage that if there are multiple clients
we can send the buffer to all the clients in one go.
2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
54a9a436ba multiudpsink: keep client list consistent during removals
We unlock and re-lock the client lock while emitting the
removed signal, which causes inconsistencies in the client
list vs. the client counts. Instead, remove the client from
the list already before emitting the signal and put it into
a temporary list of clients to be removed. That way things
look consistent to the streaming thread, but signal callbacks
can still do things like get stats from removed clients.
2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
fa3ef2e54c multiudpsink: fix client count after removal 2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
7bdf7500a1 multiudpsink: keep client list sorted by socket family
We make use of in the send_buffers() function if we
need to use different sockets to send to IPv4 and
IPv6 destinations.
2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
e1a7deb27f multiudpsink: add sendmmsg-ready render_list function prototype
Add prototype for a render_list() function that can use a
sendmmsg-style g_socket_send_messages() function once it lands
in GLib. We can use this infrastructure to send multiple buffers
made up by multiple memories to multiple clients in one go, which
drastically reduces the number of syscalls made when sending
high-bitrate video streams.

https://bugzilla.gnome.org/show_bug.cgi?id=732152
2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
dead5c2476 multiudpsink: make udp client structure refcounted
Use the refcount for memory management and keep track
of the number of duplicate clients in a separate
variable. This will be useful later, and means we
don't have to hold the OBJECT_LOCK all the time.

https://bugzilla.gnome.org/show_bug.cgi?id=732866
2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
675384a8cb multiudpsink: keep count of number of unique and non-unique IPv4 and IPv6 clients
This will come in handy later.
2014-12-16 20:26:36 +00:00
Tim-Philipp Müller
3956f5addc Sprinkle some G_PARAM_DEPRECATED and #ifndef GST_REMOVE_DEPRECATED 2014-11-02 16:58:30 +00:00
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