Commit graph

178 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Wim Taymans
f4e1bb02b7 udpsrc: use negotiated allocator or pool
Use the base class to allocate a buffer for us because it knows how
to use the negotiated allocator or bufferpool.
2012-10-10 10:10:26 +02:00
Tim-Philipp Müller
4bb52bbadf docs: gst-launch -> gst-launch-1.0 and ffmpegcolorspace -> videoconvert 2012-08-27 21:20:30 +01:00
Tim-Philipp Müller
d6f4f1e01f udpsrc: don't crash dereferencing NULL error when leaving multicast group on shutdown
Strangely enough, if we do pass an error variable to be filled, we
no longer get an error on leaving.
2012-07-24 20:06:07 +01:00
Tim-Philipp Müller
e09ae5736d Use new gst_element_class_set_static_metadata() 2012-04-10 00:51:41 +01:00
Mark Nauwelaerts
31edc9f7c0 updsrc: clear error 2012-04-05 19:17:29 +02:00
Wim Taymans
3d61d12e03 update for buffer api change 2012-03-30 18:15:34 +02:00
Raimo Järvi
eccb5b8fed udp: Fix compiling with mingw.
https://bugzilla.gnome.org/show_bug.cgi?id=672880
2012-03-27 11:42:43 +02:00
Wim Taymans
d4a10f2909 udpsrc: fix SO_RCVBUF handling 2012-03-13 20:36:56 +01:00
David Schleef
cb0d04a2db udp: Change the default port to 5004
udpsrc/udpsink are almost always used with RTP, so let's use an
RTP port as the default port.  It's unclear why 4951 was used, it
goes back to early commits in CVS.
2012-03-06 21:44:36 -08:00
Wim Taymans
ca9532ccc5 update for new memory api 2012-02-22 02:10:33 +01:00
Matej Knopp
d7695bb67d fix compiler warnings 2012-02-20 16:32:34 +01:00
Wim Taymans
9365f12d6e GST_FLOW_WRONG_STATE -> GST_FLOW_FLUSHING 2012-02-08 16:43:30 +01:00
Andoni Morales Alastruey
bb7b879545 udpsrc: fix print format 2012-01-26 16:31:24 +01:00
Vincent Penquerc'h
6429359d55 udpsrc: fix string leak 2012-01-24 14:53:38 +00:00
Vincent Penquerc'h
73754081e5 udpsrc: fix use of freed memory 2012-01-24 14:52:09 +00:00
Sebastian Dröge
2eeb0eb58e udpsrc: Remove unneeded socket.h include 2012-01-17 16:58:07 +01:00
Sebastian Dröge
6f055d554b dynudpsink: Port to GIO 2012-01-17 10:49:34 +01:00
Sebastian Dröge
7f74fc9ef6 udpsrc: Port to GIO 2012-01-17 09:07:40 +01:00
Sebastian Dröge
93e3ed5a86 Merge branch 'master' into 0.11
Conflicts:
	ext/cairo/gsttextoverlay.c
	ext/pulse/pulseaudiosink.c
	gst/audioparsers/gstaacparse.c
	gst/avi/gstavimux.c
	gst/flv/gstflvmux.c
	gst/interleave/interleave.c
	gst/isomp4/gstqtmux.c
	gst/matroska/matroska-demux.c
	gst/matroska/matroska-mux.c
	gst/matroska/matroska-mux.h
	gst/matroska/matroska-read-common.c
	gst/multifile/gstmultifilesink.c
	gst/multipart/multipartmux.c
	gst/shapewipe/gstshapewipe.c
	gst/smpte/gstsmpte.c
	gst/udp/gstmultiudpsink.c
	gst/videobox/gstvideobox.c
	gst/videocrop/gstaspectratiocrop.c
	gst/videomixer/videomixer.c
	gst/videomixer/videomixer2.c
	gst/wavparse/gstwavparse.c
	po/ja.po
	po/lv.po
	po/sr.po
	tests/check/Makefile.am
	tests/check/elements/qtmux.c
	tests/check/elements/rgvolume.c
2012-01-10 14:32:32 +01:00
Tim-Philipp Müller
86cd5bd7f2 udpsrc: fix valgrind warning
https://bugzilla.gnome.org/show_bug.cgi?id=666644
2011-12-27 11:50:03 +00:00
John Ogness
0c4b60f010 udpsrc: drop dataless UDP packets
It is allowed to send/receive UDP packets with no data. When such
a packet is available, select() will return with success but
ioctl(FIONREAD) will return 0. But a read() must still occur in
order to clear off the UDP packet from the queue.

This patch will read the dataless packet from the socket. If
select() was woken for other reasons (and FIONREAD returns 0),
this may result in a UDP packet getting accidentally dropped.
But since UDP is not reliable, this is acceptable.

NOTE: This patch fixes a nasty bug where sending a dataless
      UDP packet to a udpsrc instance will cause an infinite
      loop.

https://bugzilla.gnome.org/show_bug.cgi?id=666644

Signed-off-by: John Ogness <john.ogness@linutronix.de>
2011-12-27 01:40:34 +00:00
Vincent Penquerc'h
c0e101e93f various: fix pad template leaks
https://bugzilla.gnome.org/show_bug.cgi?id=662664
2011-11-28 13:30:27 +00:00
Tim-Philipp Müller
c27bbe4be2 Update for GstURIHandler get_protocols() changes 2011-11-13 23:44:44 +00:00
Tim-Philipp Müller
a150d1e734 soup, pushfile, rtsp, udp, v4l2: update for GstURIHandler API changes 2011-11-13 18:50:51 +00:00