summaryrefslogtreecommitdiff
path: root/libavformat/udp.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/udp: check for memory allocation failure when setting localaddrjackarain2023-03-081-0/+4
| | | | | Signed-off-by: jackarain <jack.wgm@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf: set internal thread namesAnton Khirnov2022-10-241-0/+4
|
* avformat/udp: remove IPPROTO_IPV6 macroLimin Wang2022-02-121-1/+1
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: Fix IP_MULTICAST_TTL for BSD compatibilityLimin Wang2022-02-121-2/+12
| | | | | | | | | | Suggested by zhilizhao, vlc project has solved the compatibility by the same way, so I borrowed the comments from vlc project. Fixes ticket #9449 Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: use one setsockopt for ipv4/ipv6Limin Wang2022-02-121-12/+20
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: properly check for valid ttl in urlLimin Wang2022-02-121-0/+5
| | | | | | | Zhao Zhili added a ttl upper bound in commit 9daac85da8, but the check for ttl in url is missing still. Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* lavf/udp: switch to new FIFO APIAnton Khirnov2022-02-071-17/+17
|
* avformat/udp: set ttl upper bound to 255Zhao Zhili2022-02-061-1/+1
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/network: log ff_socket() errors to proper contexts rather than NULLAnton Khirnov2022-01-211-2/+2
|
* lavf/udp: log net errors to proper contexts rather than NULLAnton Khirnov2022-01-211-15/+20
|
* lavf/udp: do not return an uninitialized value from udp_open()Anton Khirnov2022-01-111-2/+6
|
* avformat/udp: remove local localaddr arrayLimin Wang2021-11-261-6/+4
| | | | | Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: fix check for pthread_cond_wait return valueZhao Zhili2021-07-101-3/+1
| | | | | | | | POSIX errno is positive. We have strict_pthread_cond_wait to handle error code during development. Signed-off-by: zhilizhao <zhilizhao@tencent.com> Reviewed-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/udp: add memory alloc checksLimin Wang2021-01-161-0/+4
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: return the error code instead of generic EIOLimin Wang2021-01-161-22/+36
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: cosmeticsLimin Wang2020-10-221-16/+15
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: clarify option description for timeout unitLimin Wang2020-10-221-1/+1
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/udp: remove redundant setting of h->max_packet_sizeZhao Zhili2020-10-161-3/+0
| | | | | | h->max_packet_size is being reset in the following code. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/udp: fix the comments for default UDP socket recvbuf sizeJun Zhao2020-07-121-1/+1
| | | | | | | | 15d160cc0b2 increased the UDP socket receiving buffer size (64K ->384K), but missed to update this comments. Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avformat/udp: support w32pthreads compatphunkyfish2020-03-081-1/+6
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: cancel pending IO on win32 manuallyMarton Balint2020-02-021-1/+10
| | | | | | | | | | | | | recvfrom() is not a cancellation point in pthreads-win32, see https://sourceware.org/pthreads-win32/manual/pthread_cancel.html In order to be able to cancel the reader thread on Win32 properly we first shutdown the socket then call CancelIoEx to abort pending IO. Subsequent recvfrom() calls will fail with WSAESHUTDOWN causing the thread to exit. Fixes ticket #5717. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: remove setting cancel state from the TX threadMarton Balint2020-02-021-4/+0
| | | | | | Write mode does not use cancellation. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: increase the default buffer size of a receiving socket to 384KMarton Balint2020-01-251-1/+2
| | | | | | | | | | | | It is a common mistake that people only increase fifo_size when they experience drops, unfortunately this does not help for higher bitrate (> 100 Mbps) streams when the reader thread simply might not receive the packets in time (especially under high CPU load) if the default 64 KB of kernel buffer size is used. New default is determined so that common linux systems can set this buffer size without tuning kernel parameters. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: properly use return value of pthread_cond_timedwaitMarton Balint2020-01-251-2/+3
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: add newline after warningMarton Balint2020-01-251-1/+1
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: modify the not write-only to read-only mode.Xuchen Su2020-01-201-1/+1
| | | | | | not write-only include read-write pseudo flag. so make the flag read-only Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/udp: add logging context to logSteven Liu2019-10-081-4/+4
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/udp: always use IP_ADD_SOURCE_MEMBERSHIP for subscribing to an UDP ↵Marton Balint2018-10-031-24/+28
| | | | | | | | | | | | | | multicast source group in IPv4 That alone supports specifying the interface based on its address. Getting the interface index from the local address seems quite a bit of work in a platform independent way... Obviously for IPv6 we still always use MCAST_JOIN_SOURCE_GROUP. As a side effect this also fixes ticket #7459. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: specify the local address for some source filtered multicast joinsMarton Balint2018-10-031-4/+11
| | | | | | | | | | | | | We already use localaddr for the multicast joins without source filters, so we should use them for source filters as well. This patch only fixes the IP_ADD_SOURCE_MEMBERSHIP and the IP_BLOCK_SOURCE case. Unless we do this, the kernel automatically selects an interface based on the source address, and that interface might be different from the one set in localaddr. For blocked sources this even casues EINVAL because we joined the multicast group on a different interface. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: add support for generic source filteringMarton Balint2018-10-031-4/+13
| | | | | | | | This allows getting data only from a specific source IP. This is useful not only for unicast but for multicast as well because multicast source subscriptions do not act as source filters for the incoming packets. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/udp: use factorized ip functionsMarton Balint2018-10-031-102/+21
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/udp: use ff_log_net_error to replace log_net_errorJun Zhao2018-08-181-24/+17
| | | | Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* Revert "udp: fix compilation when HAVE_PTHREAD_CANCEL isnt defined"Derek Buitenhuis2017-11-231-4/+0
| | | | | | | | This was an mplayer-specific hack. This reverts commit a4f94f24b4f153c30bbcaa700bedfb2b3a581e5e. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* lavf/udp: Do not use MCAST_* for multicast on tvOS.Carl Eugen Hoyos2016-09-031-1/+5
| | | | Fixes ticket #5774.
* avformat/udp: replace packet_gap with bitrate optionMarton Balint2016-06-191-18/+33
| | | | | | | | 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>
* avformat/udp: do not accumulate packet_gap delay errorsMarton Balint2016-06-191-2/+13
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/udp: fix dead code.Nicolas George2016-06-031-1/+1
| | | | | | | | | | 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.
* avformat/udp: Protect write to circular_buffer_error by mutexMichael Niedermayer2016-06-021-0/+2
| | | | | | | This isnt really needed on most platforms but fixes CID1362183 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/udp: Remove unused variableMichael Niedermayer2016-05-291-1/+0
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/udp: Close the socket after destroying the thread using the socketMichael Niedermayer2016-05-251-1/+1
| | | | | | for send() this cannot work and even for recv() it feels very wrong and hackish Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/udp: redesign threaded udp tx codeMichael Niedermayer2016-05-251-42/+58
| | | | | | | | | | | 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>
* avformat/udp: Add a delay between packets for streaming to clients with ↵Pavel Nikiforov2016-05-251-3/+131
| | | | | | | | | | | | | | | | 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>
* Merge commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d'Derek Buitenhuis2016-02-291-2/+2
|\ | | | | | | | | | | | | | | | | | | | | 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>
| * lavf: reorganize URLProtocolsAnton Khirnov2016-02-221-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
* | avformat: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-041-5/+5
| |
* | Merge commit '12b14382861fbf19378afcddaa19cd9a949a86a3'Hendrik Leppkes2015-11-291-1/+3
|\ \ | |/ | | | | | | | | | | * commit '12b14382861fbf19378afcddaa19cd9a949a86a3': udp: Provide additional information on getaddrinfo failure Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * udp: Provide additional information on getaddrinfo failureLuca Barbato2015-11-251-1/+3
| |
* | Merge commit '34af7813f77e2b5b9dcb34f20bcf53bfcc0ba9c9'Hendrik Leppkes2015-11-291-14/+28
|\ \ | |/ | | | | | | | | | | * commit '34af7813f77e2b5b9dcb34f20bcf53bfcc0ba9c9': udp: Use the logging context Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * udp: Use the logging contextLuca Barbato2015-11-251-14/+28
| |
| * udp: Fix local_port managementLuca Barbato2015-06-221-1/+1
| | | | | | | | | | | | The default value for unset is -1, not 0. Problem introduced in 66028b7ba6b411ba12ef553e9c8f1f4a4fe27710