1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

226 Commits

Author SHA1 Message Date
Carl Eugen Hoyos
3c821a1a7b lavf/udp: Do not use MCAST_* for multicast on tvOS.
Fixes ticket #5774.
2016-09-03 15:18:40 +02:00
Marton Balint
cc16229d91 avformat/udp: replace packet_gap with bitrate option
We haven't had a stable release since the packet_gap addition, so probably it
is worth reworking the option to something that makes more sense to the end
user. Also add burst_bits option to specify maximum length of bit bursts.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-19 22:55:57 +02:00
Marton Balint
0a06569487 avformat/udp: do not accumulate packet_gap delay errors
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-19 22:54:57 +02:00
Nicolas George
8b05a7ffe4 lavf/udp: fix dead code.
Since d607861, service can not be NULL, only "0".
An UDP address with neither local port nor address leaves both
service and node to their default value, and POSIX specifies
that they are not allowed to be both NULL; "0" is equivalent
to an unspecified port for all currently known protocols.

Fix CID 1341570.
2016-06-03 12:46:02 +02:00
Michael Niedermayer
4865252c08 avformat/udp: Protect write to circular_buffer_error by mutex
This isnt really needed on most platforms but
fixes CID1362183

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-02 13:41:04 +02:00
Michael Niedermayer
cbd19881f7 avformat/udp: Remove unused variable
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-29 12:35:14 +02:00
Michael Niedermayer
9591ca704b avformat/udp: Close the socket after destroying the thread using the socket
for send() this cannot work and even for recv() it feels very wrong and hackish

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-25 01:39:23 +02:00
Michael Niedermayer
9b7a8bddac avformat/udp: redesign threaded udp tx code
This fixes partially completed send()
Avoids holding the mutex during send()
fixes race conditions in error handling
removes copied non thread specific blocking code
Fixes deadlocks on closure
Fixes data loss on closure

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-25 01:39:23 +02:00
Pavel Nikiforov
413c842a69 avformat/udp: Add a delay between packets for streaming to clients with short buffer
This commit enables sending UDP packets in a background thread with specified delay.
When sending packets without a delay some devices with small RX buffer
( MAG200 STB, for example) will drop tail packets in bursts causing
decoding errors.

To use it specify "fifo_size" with "packet_gap" .

The output url will looks like udp://xxx:yyy?fifo_size=<output fifo
size>&packet_gap=<delay in usecs>

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-25 01:39:22 +02:00
Derek Buitenhuis
9c75148e6e Merge commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d'
This commit also disables the async fate test, because it
used internal APIs in a non-kosher way, which no longer
exists.

* commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d':
  lavf: reorganize URLProtocols

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 16:51:10 +00:00
Anton Khirnov
2758cdedfb lavf: reorganize URLProtocols
Instead of a linked list constructed at av_register_all(), store them
in a constant array of pointers.

Since no registration is necessary now, this removes some global state
from lavf. This will also allow the urlprotocol layer caller to limit
the available protocols in a simple and flexible way in the following
commits.
2016-02-22 11:30:58 +01:00
Clément Bœsch
43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Hendrik Leppkes
a6dac0b410 Merge commit '12b14382861fbf19378afcddaa19cd9a949a86a3'
* commit '12b14382861fbf19378afcddaa19cd9a949a86a3':
  udp: Provide additional information on getaddrinfo failure

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-29 16:12:38 +01:00
Hendrik Leppkes
bf54377001 Merge commit '34af7813f77e2b5b9dcb34f20bcf53bfcc0ba9c9'
* commit '34af7813f77e2b5b9dcb34f20bcf53bfcc0ba9c9':
  udp: Use the logging context

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-29 16:11:16 +01:00
Luca Barbato
12b1438286 udp: Provide additional information on getaddrinfo failure 2015-11-25 09:01:25 +01:00
Luca Barbato
34af7813f7 udp: Use the logging context 2015-11-25 09:01:25 +01:00
Ganesh Ajjanagadde
26e8895b73 all: add _DEFAULT_SOURCE locally wherever needed
Glibc 2.20 onwards generates a deprecation warning for usage of _BSD_SOURCE and _SVID_SOURCE.
The solution from man feature_test_macros is to define both _DEFAULT_SOURCE and the old macros.
This solution is on the lines of the one in commit af1818276e.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2015-10-04 12:15:16 -04:00
Luca Barbato
61dc9d647c udp: Fix local_port management
The default value for unset is -1, not 0.

Problem introduced in 66028b7ba6
2015-06-22 10:47:29 +03:00
Michael Niedermayer
d0059281e6 avformat/udp: Remove (harmless) duplicated pkt_size entry from AVOption table
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-29 22:10:05 +02:00
Michael Niedermayer
8344350509 Merge commit 'ff7adead0a667e606f5a41dca591f074f9ff2f32'
* commit 'ff7adead0a667e606f5a41dca591f074f9ff2f32':
  udp: Fix pkt_size management

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-29 22:06:44 +02:00
Luca Barbato
ff7adead0a udp: Fix pkt_size management
The default value for unset is -1, not 0.

Problem introduced in 66028b7ba6

Bug-Id: 835
2015-03-29 17:35:59 +02:00
Michael Niedermayer
4f8540ba40 Merge commit '8dc72eeaf647736c287b59a3856a11904bedd58b'
* commit '8dc72eeaf647736c287b59a3856a11904bedd58b':
  udp: Fix crashes after adding AVOptions

See: aefed6ca87
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 11:22:39 +01:00
Martin Storsjö
8dc72eeaf6 udp: Fix crashes after adding AVOptions
Add a missing AVClass member, check whether localaddr is null.
(Previously, localaddr was always a local stack buffer, while it
now also can be an avoption string which can be null.)

This fixes crashes when not passing any localaddr parameter, since
66028b7ba.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:25:22 +02:00
Michael Niedermayer
4f3f5ee1ac Merge commit '66028b7ba6b411ba12ef553e9c8f1f4a4fe27710'
* commit '66028b7ba6b411ba12ef553e9c8f1f4a4fe27710':
  udp: Use AVOptions

Conflicts:
	libavformat/udp.c

See: aefed6ca87
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-16 00:10:09 +01:00
Luca Barbato
66028b7ba6 udp: Use AVOptions
Add AVOptions for options currently available as url parameters.
2015-03-15 18:29:11 +01:00
Michael Niedermayer
a0fe1a25fa Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'
* commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e':
  avformat: Don't anonymously typedef structs

Conflicts:
	libavformat/adtsenc.c
	libavformat/aiffenc.c
	libavformat/avidec.c
	libavformat/gif.c
	libavformat/iff.c
	libavformat/img2dec.c
	libavformat/jvdec.c
	libavformat/matroskadec.c
	libavformat/udp.c
	libavformat/wtvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:07:40 +01:00
Diego Biurrun
daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Vincent Bernat
5269cef408 avformat/udp: Allow to specify DSCP class
By appending `?dscp=26` to the URL, IP packets will be classified as
AF31 (assured forwarding for multimedia flows with low probability of
loss). On congested network, this allows a user to assign priorities to
flows.

Signed-off-by: Vincent Bernat <vincent@bernat.im>
2014-11-27 19:53:09 +01:00
Thomas Volkert
07c3a4f693 avformat/udp: UDP-Lite (RFC 3828) support added
(This fixes ticket #1501)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-05 11:16:05 +01:00
Michael Niedermayer
97cebf3139 avformat/udp: Move variables used only with HAVE_PTHREAD_CANCEL, under the #if
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-30 12:43:58 +02:00
Michael Niedermayer
74c81106d2 avformat/udp: remove unneeded variable initialization
Found-by: James Darnley <james.darnley@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-16 15:58:40 +02:00
Michael Niedermayer
7916053ced avformat/udp: dont mix integers with pointers
Reviewed-by: James Darnley <james.darnley@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-16 15:58:40 +02:00
Michael Niedermayer
b2d1e22c2a avformat/udp: fix build on MINIX
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-07 14:43:07 +02:00
Olivier Langlois
f1c167496e Support broadcast destination for udp protocol
Use the required socket option SO_BROADCAST to be able to stream to a broadcast
address.

Prior to the patch, trying to stream to a broadcast address was resulting to the
following error:

av_interleaved_write_frame(): Permission denied

The patch has been tested with:

ffmpeg -f v4l2 -framerate 30 -input_format yuyv422 -video_size 640x480 -i /dev/video0 \
 -c:v libx264 -profile:v high -preset ultrafast -tune zerolatency -b:v 500k -pix_fmt yuv420p \
 -f mpegts udp://192.168.1.255:5004?broadcast=1

I have added an option to let the user explicitly request broadcast in order to avoid
ffmpeg to broadcast unintentionally.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-13 15:51:41 +02:00
Lukasz Marek
ce1eefe691 lavf: use av_fifo_freep
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-05-07 23:39:47 +02:00
rogerdpack
0b4c5c99bc avformat/udp: cleanup comments, add a warning if receive buffer is unexpectedly unable to be set high enough
which can happen easily in linux

Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-22 16:40:46 +01:00
rogerdpack
2be1e1b223 avformat/udp: debug log udp socket size
Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-08 23:56:05 +01:00
Stefano Sabatini
b80cf46090 doc/protocols/udp,lavf/udp: apply minor documentation fixes 2013-12-25 18:42:15 +01:00
Stoian Ivanov
5fe415f0f4 UDP: join multicast group on the interface specified with &localaddr=
When joining multicast groups, ffmpeg was using INADDR_ANY as interface address
which leads to enabling the multicast group on the interface with "default gateway".
Often multicast traffic is received over dedicated interface, which scenario ffmpeg was
unable to handle. With this patch, ffmpeg will enable multicast group to the interfaces
configured with address specified in &localaddr= parameter of udp:// URL. To avoid
loacal_addr resolve at udp_close(...) the UDPContext structure was extended with
struct sockaddr_storage local_addr_storage member, which is populated in udp_open(..)
and passed to udp_join_multicast_group()  and udp_leave_multicast_group().

Signed-off-by: Stoian Ivanov <s.ivanov@teracomm.bg>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-17 01:14:28 +01:00
Michael Niedermayer
2539767206 Merge commit 'bb9378251a167ef0116f263912e57f715c1e02ac'
* commit 'bb9378251a167ef0116f263912e57f715c1e02ac':
  network: Use SOCK_CLOEXEC when available

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 15:40:05 +02:00
Luca Barbato
bb9378251a network: Use SOCK_CLOEXEC when available 2013-08-05 16:13:36 +02:00
Michael Niedermayer
42f7c45d7b Merge commit '7d99c92945e4b2d12ed2126365482e1900340da0'
* commit '7d99c92945e4b2d12ed2126365482e1900340da0':
  udp: Keep track of include and exclude sources separately

Conflicts:
	libavformat/udp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 11:40:05 +02:00
Michael Niedermayer
15ca3ab825 Merge commit '3357bccc5cb31795f248cd72dc480025f3075a5b'
* commit '3357bccc5cb31795f248cd72dc480025f3075a5b':
  udp: Allow specifying multicast include/blocks as host names as well

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 11:31:17 +02:00
Ed Torbett
7d99c92945 udp: Keep track of include and exclude sources separately
This allows us to explicitly fail if the caller tried to set
both inclusions and exclusions at the same time.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 22:58:54 +03:00
Ed Torbett
3357bccc5c udp: Allow specifying multicast include/blocks as host names as well
Previously this only allowed literal IP addresses. When these
are conveyed in a SDP file as in RFC4570, host names are allowed
as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-29 22:58:53 +03:00
Michael Niedermayer
804c7b2c62 udp: Fix receiving large udp packets
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-29 00:10:15 +02:00
Michael Niedermayer
9cf788eca8 avformat/avdevice: add missing time.h includes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-12 15:28:22 +01:00
Michael Niedermayer
282a6308bf udp: check ff_socket_nonblock() return code
Fixes CID733719
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-05 21:21:04 +01:00
Michael Niedermayer
8943ad4014 Merge commit '4521645b1aee9e9ad8f5cea7b2392cd5f6ffcd26'
* commit '4521645b1aee9e9ad8f5cea7b2392cd5f6ffcd26':
  avio: fix pointer type mismatches in avio_enum_protocols()
  avserver: use socklen_t where appropriate
  udp: use socklen_t where appropriate
  network: use HAVE_THREADS instead of local hack
  af_channelmap: remove stray enum declaration
  buffersink: remove stray semicolon after function definition

Conflicts:
	libavformat/avio.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-28 13:19:11 +01:00
Mans Rullgard
be2efe0c7b udp: use socklen_t where appropriate
getsockname() takes a pointer to socklen_t which is not necessarily
int.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-27 13:11:46 +01:00