Commit Graph

184 Commits

Author SHA1 Message Date
Rémi Denis-Courmont
7afbace590 access/udp: use pf_read rather than pf_block
With pf_block, there is, for each received packet:
- one heap allocation for the block_t,
- one memory copy from the block_t into the downstream filter/demux
  (normally the prefetch filter) in the stream core, and
- one heap free in the stream core.
And it gets worse if the packet size exceeds the MRU (1316 bytes).

In practice, the read size (from the prefetch filter) is almost always
much larger than the packet size. Using pf_read, we eliminate both the
heap manipulations and the memory copies, both for sanely sized and
insanely sized fragmented packets.

In the corner case that the read size is actually small, this uses a
circular buffer and incurs one memory copy. That is still faster than
the pf_block logic.
2019-05-19 18:33:43 +03:00
Rémi Denis-Courmont
afbaaea4e9 access/udp: remove stray messages 2019-05-19 18:33:43 +03:00
Rémi Denis-Courmont
f2dceb3c11 access/udp: reorder to avoid forward declarations
No functional changes.
2019-05-19 18:33:41 +03:00
Rémi Denis-Courmont
b42935fa3f udp: fix comparison signedness 2019-03-02 21:28:26 +02:00
Steve Lhomme
5363279805 remove the $Id$ in the source code 2019-01-17 12:21:18 +01:00
Nick Briggs
4f633b7ad7 access/udp: use overflow block on recvmsg() to adjust mtu
Add second block on recvmsg() to check if we need to adjust mtu to be
higher. With this approach, we will do extra memcpy and allocation in
codepaths where mtu should be increased, but not on normal codepath.

Allocates the minimum sized overflow block to capture the maximum
sized datagram when combined with the normal (mtu sized) block.

This uses the same approach on all platforms and doesn't rely on
MSG_TRUNC in linux case and something else in other cases.
2018-11-04 22:05:56 +02:00
Ilkka Ollakka
373ee85fe5 access/udp: Define MSG_TRUNC on recv call
recv() needs MSG_TRUNC flag so it will tell actual data-size if truncate
would happen additional to setting flag for it.

Tested adjustment of MTU by sending data to localhost via netcat:

cat ~/tmp/myfile.mp3|netcat -u 127.0.0.1 1234

and vlc -Idummy -vv udp://@127.0.0.1:1234 --sout="#stat"

without this patch the udp input constantly complains about trunced
input and doesn't adjust the receiving amount.

udp fixup

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2018-10-15 19:12:44 +03:00
Steve Lhomme
26fef56c52 core: make DEMUX/STREAM_GET_PTS_DELAY officially a vlc_tick_t 2018-07-06 10:48:19 +02:00
Steve Lhomme
f8872ec589 modules: the "network-caching" is always translated to a vlc_tick_t 2018-07-06 09:53:20 +02:00
Romain Vimont
ff2901aff3 core: remove global *_sys_t typedefs
Do not declare *_sys_t typedefs globally in vlc_common.h. Instead,
declare them locally in each module that provides a definition.

This paves the way to move C++ definitions into anonymous namespaces in
order to respect C++ ODR.

The picture_resource_t and sout_stream_id_sys_t typedefs will be handled
separately, since they require specific additional changes.

See #18033

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
2018-04-30 14:20:50 +02:00
Rémi Denis-Courmont
bf51e08802 objres: restore malloc() wrapper
Regression from cf4676c1e8.
2017-11-28 18:54:06 +02:00
Thomas Guillem
cf4676c1e8 core: rename vlc_*alloc to vlc_obj_*alloc
In order to avoid confusion with future vlc_alloc.
2017-11-11 17:20:34 +01:00
Rémi Denis-Courmont
e4ba64d291 Remove access_t 2017-07-23 08:55:40 +03:00
Rémi Denis-Courmont
740dd861a4 access: allocate p_sys vlc_malloc/vlc_calloc 2017-06-19 22:48:08 +03:00
Rémi Denis-Courmont
94212096a6 udp: remove redundant casts 2017-04-19 20:46:56 +03:00
Dennis Hamester
4c853b5477 Include sys/uio.h where necessary
All touched files use struct iovec without making sure sys/uio.h is
included.

Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2017-03-21 21:46:56 +02:00
Rémi Denis-Courmont
6238579234 udp: remove redundant thread
The I/O thread has been made redundant by the prefetch filter.
Remove it and simplify accordingly.
2016-10-19 14:49:31 +03:00
Ilkka Ollakka
badd3e9168 access: udp: only dequeue one after sem_wait
This helps to keep semaphore value in a meaningful state.
Also there is no need to post semaphore on timeout case.
2016-09-24 16:47:33 +03:00
Rémi Denis-Courmont
3e01621dc6 access: remove ACCESS controls, use STREAM
They have been identical for a while.
2016-07-21 19:59:24 +03:00
Rémi Denis-Courmont
fdcd2b0fd1 udp: simplify timeout handling using atomic 2016-07-21 19:59:24 +03:00
Rémi Denis-Courmont
da458bc49c access: info.b_eof is always false during probe 2016-07-21 19:59:24 +03:00
Rémi Denis-Courmont
2381c5b860 access: add flag for EOF in pf_block prototype
pf_read() returns 0 to signify EOF, and -1 to signify no data.
pf_block() returns NULL either way. This flag is added for the
distinction.
2016-07-21 19:59:24 +03:00
Thomas Guillem
967cd8e2d2 udp: don't preparse 2016-06-05 12:58:34 +02:00
Rémi Denis-Courmont
256919fcff udp: use more reasonable default buffer size (fixes #16315) 2016-04-17 22:12:49 +03:00
Ilkka Ollakka
36591a61c7 udp: add timeout parameter
By default we wait -1 as previously, but you can give --udp-timeout as timeout in seconds
how long we wait for next packet before deciding that input has ended.
2016-03-18 17:15:36 +02:00
Rémi Denis-Courmont
b9d91820ea udp: simplify based on previous commit (refs #13979) 2015-07-01 19:17:53 +03:00
Rémi Denis-Courmont
ce3bd683fe udp: improve out-of-memory handling 2015-06-05 23:27:43 +03:00
Rémi Denis-Courmont
57faaf399a udp: remove useless loop in the block callback
In case of spurious wake-up, the function will return NULL. This is OK.
2015-06-03 20:34:33 +03:00
Rémi Denis-Courmont
c0cdab15a4 Remove no longer used net_Read() argument 2015-05-12 22:25:11 +03:00
Rémi Denis-Courmont
b70d2acf4c udp: fix locking (fixes #14234) and cancellation 2015-03-23 23:39:25 +02:00
Rémi Denis-Courmont
34b47be984 udp: use the new FIFO functions 2015-03-19 19:56:09 +02:00
Rémi Denis-Courmont
efc27f3603 udp: avoid alloc/free on I/O error 2015-03-17 20:50:30 +02:00
Rémi Denis-Courmont
613ea43a83 udp: fix potential deadlock at exit 2015-02-25 18:38:30 +02:00
Rémi Denis-Courmont
00b9dd8cbc udp: memory leak 2014-11-14 19:24:05 +02:00
Ilkka Ollakka
b0e5abcd7f udp: restore original flow without else block
commit 7fff679f14 added else block and
left continue that didn't make code flow following any easier.
2014-10-01 07:44:22 +03:00
Ilkka Ollakka
7fff679f14 udp: don't realloc in receiving, just set i_buffer
Similar than rtp input does, doing realloc from 64k->1.5k would
usually mean extra malloc+memcpy per packet.

Also don't pass buffer onward if we don't receive any useful stuff (-1)
2014-09-30 21:23:20 +03:00
Rémi Denis-Courmont
26b2eff7cf access: simplify control default case, remove dummy warnings 2013-08-26 20:05:05 +03:00
Tzu-Jung Lee
57eee64625 udp: pull and buffer received packets in udp access module
Signed-off-by: Tzu-Jung Lee <tjlee@ambarella.com>
Modified-and-...
Signed-off-by: Rémi Denis-Courmont <remi@remlab.net>
2013-08-24 13:04:56 +03:00
Rémi Denis-Courmont
a7440cbaed udp: handle error 2013-04-30 17:56:34 +03:00
Rémi Denis-Courmont
4c654c6a41 udp: remove impossible case
EOF is never set in this plugin.
2013-04-30 17:53:21 +03:00
Rémi Denis-Courmont
5270796734 Replace block_New() with block_Alloc() 2012-12-13 23:17:40 +02:00
Jean-Baptiste Kempf
fef270581f LGPL
Re-license almost all the playback modules to LGPLv2.1+ with
authorization from their respective contributors (230+)

This includes:
 - access, codec, packetizers, demux
 - audio filters, audio mixers, audio output
 - video filters, video chroma, video output
 - text renderers
 - XML parser
 - ARM NEON and SSE2 optimisations (mostly for chromas and filters)

Some modules are not concerned:
 - BDA and DShow access modules because Manol Manolov is AWOL
 - Real RTSP, because it is derived from Xine
 - x264 and t140 because they are encoders only
 - DLL Loader, because it is derived from MPlayer
 - DTS packetizer, because Jon Lech Johansen is AWOL
 - Shine and WMAfixed, because they are derived from Rockbox
 - Real demuxer, as it is derived from MPlayer and Wang Bo is AWOL
 - MPC demuxer, as Yavor Doganov is AWOL
 - Tivo demuxer, because it is derived from an MPlayer fork
 - Playlist demuxer, (WPL and ZPL parts missing), because suheaven is AWOL
 - iOS audio output and video display, because author refuses the license change
 - Equalizer and compressor, because Ronald Wright is AWOL
 - Mono, Headphone and Dolby, because author refuses the license change
 - hqdn3d and yadif, because they are from MPlayer/libavfilter
 - remoteosd, because it derives from RealVNC code
 - MMX optimisations, because Ollie Lho, from SiS, is AWOL
 - Rotate, because it depends on GPL motion

Nota Bene:
 - Some modules depend on GPL-only libraries, a LGPL module does not mean
   that the resulting binary module will be LGPL.
   Libraries affected would include liba52, libdvdcss, libdvdnav, libdvdread,
   faad2, libdca, libmad, libmpeg2, libpostproc, SRC, sid, zvbi and probably others.
2012-11-13 16:25:56 +01:00
Rafaël Carré
90b7695c83 Mention 2.0.0 instead of 1.2.0 2012-02-05 12:46:04 -05:00
Rémi Denis-Courmont
31ac20b22f Unify (ACCESS|DEMUX)_GET_PTS_DELAY 2011-08-30 21:33:18 +03:00
Rémi Denis-Courmont
e2138e80ee Remove redumdant family parameter to net_OpenDgram() 2011-08-22 17:32:00 +03:00
Rémi Denis-Courmont
33fbd25396 Remove server-port and mark it obsolete
If a non-default UDP multicast destination port is used, it can and
should be specified through the MRL. Anyway, you should not use raw UDP
streaming ;-)
2011-08-02 18:08:51 +03:00
Rémi Denis-Courmont
1ecc6bef45 Remove stray #define 2011-08-02 18:08:51 +03:00
Rémi Denis-Courmont
f98a66cea0 add_integer: remove callback parameter 2010-10-22 21:10:50 +03:00
Rémi Duraffort
295b0e0752 Use var_Inherit* when applicable. 2010-08-17 21:57:44 +02:00
Rémi Duraffort
49c2f12198 access_udp: remove obsolete shortcuts. 2010-08-17 21:55:38 +02:00