summaryrefslogtreecommitdiff
path: root/libavformat/network.c
Commit message (Collapse)AuthorAge
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* Remove unnecessary libavutil/(avutil|common|internal).h inclusionsAndreas Rheinhardt2022-02-24
| | | | | | | | | | Some of these were made possible by moving several common macros to libavutil/macros.h. While just at it, also improve the other headers a bit. Reviewed-by: Martin Storsjö <martin@martin.st> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Remove unnecessary libavcodec/internal.h inclusionsAndreas Rheinhardt2022-02-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavf/network: log ff_listen() errors to proper contexts rather than NULLAnton Khirnov2022-01-21
|
* lavf/network: log ff_socket() errors to proper contexts rather than NULLAnton Khirnov2022-01-21
|
* avformat/network: add logging context to logSteven Liu2019-10-08
| | | | Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* Merge commit '9b4c3f5aadf54ffd2a6e15746b1fd736379883c4'James Almer2018-09-11
|\ | | | | | | | | | | | | * commit '9b4c3f5aadf54ffd2a6e15746b1fd736379883c4': network: Add RFC 8305 style "Happy Eyeballs"/"Fast Fallback" helper function Merged-by: James Almer <jamrial@gmail.com>
| * network: Add RFC 8305 style "Happy Eyeballs"/"Fast Fallback" helper functionMartin Storsjö2018-08-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For cases with dual stack (IPv4 + IPv6) connectivity, but where one stack potentially is less reliable, strive to trying to connect over both protocols in parallel, using whichever address connected first. In cases with a hostname resolving to multiple IPv4 and IPv6 addresses, the current connection mechanism would try all addresses in the order returned by getaddrinfo (with all IPv6 addresses ordered before the IPv4 addresses normally). If connection attempts to the IPv6 addresses return quickly with an error, this was no problem, but if they were unsuccessful leading up to timeouts, the connection process would have to wait for timeouts on all IPv6 target addresses before attempting any IPv4 address. Similar to what RFC 8305 suggests, reorder the list of addresses to try connecting to, interleaving address families. After starting one connection attempt, start another one in parallel after a small delay (200 ms as suggested by the RFC). For cases with unreliable IPv6 but reliable IPv4, this should make connection attempts work as reliably as with plain IPv4, with only an extra 200 ms of connection delay. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit '22f98ac19cf29f22b3e1d10314df9503f06fe683'James Almer2018-09-11
|\| | | | | | | | | | | | | * commit '22f98ac19cf29f22b3e1d10314df9503f06fe683': network: Check for EINTR in ff_poll_interrupt Merged-by: James Almer <jamrial@gmail.com>
| * network: Check for EINTR in ff_poll_interruptMartin Storsjö2018-08-14
| | | | | | | | Signed-off-by: Martin Storsjö <martin@martin.st>
| * network: Use ff_neterrno instead of AVERROR(errno) for poll errorsSimon Thelen2018-08-14
| | | | | | | | | | | | This makes sure to pick up the actual error codes on windows. Signed-off-by: Martin Storsjö <martin@martin.st>
* | lavf/network: check return value of setsockopt.Jun Zhao2018-08-18
| | | | | | | | Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* | lavf/network: add a ff_log_net_error function.Jun Zhao2018-08-18
| | | | | | | | | | | | add a ff_log_net_error function for error log. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* | avformat: make avformat_network_init() explicitly optionalwm42018-01-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was sort of optional before - if you didn't call it, networking was initialized on demand, and an ugly warning was logged. Also, the doxygen comments threatened that it would be made strictly required one day. Make it explicitly optional. I would prefer to deprecate it fully, but there might still be legitimate reasons to use this. But the average user won't need it. This is needed only for two reasons: to initialize TLS libraries like OpenSSL and GnuTLS, and winsock. OpenSSL and GnuTLS were already silently initialized on demand if the global network init function was not called. They also have various thread-safety acrobatics, which make concurrent initialization within libavformat safe. In addition, the libraries are moving towards making their global init functions safe, which removes all need for central global init. In particular, GnuTLS 3.5.16 and OpenSSL 1.1.0g have been found to have safe init functions. In all cases, they use internal reference counters to avoid that the global uninit functions interfere with concurrent uses of the library by other API users who called global init. winsock should be thread-safe as well, and maintains an internal reference counter as well. Since we still support ancient TLS libraries, which do not have this fixed, and since it's unknown whether winsock and GnuTLS reinitialization is costly in any way, don't deprecate the libavformat functions yet.
* | http: block while waiting for reconnectingwm42018-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It makes no sense to return an error after the first reconnect, and then somehow resume the next time it's called. Usually this will lead to demuxer errors. Make reconnecting block instead, until it has either successfully reconnected, or given up. Also make the wait reasonably interruptible. Since there is no mechanism for this in the API, polling is the best we can do. This behaves roughly the same as other interruptible network functions in libavformat. (The original code would work if it returned AVERROR(EAGAIN) or so, which would make retry_transfer_wrapper() repeat the read call. But I think having an explicit loop for this is better anyway.) I also snuck in a fix for reconnect_at_eof. It has to check for AVERROR_EOF, not 0.
* | Merge commit '61cec5adaacb358783c18aa07362f15824c1b274'James Almer2017-11-01
|\| | | | | | | | | | | | | | | | | | | * commit '61cec5adaacb358783c18aa07362f15824c1b274': tls: Hide backend implementation details from users Also includes ed434be106a4615e0419b3ac7664220741afda2d Changes were made to support schannel and securetransport. Merged-by: James Almer <jamrial@gmail.com>
| * tls: Hide backend implementation details from usersDiego Biurrun2017-06-02
| | | | | | | | | | | | | | | | TLS is currently implemented over either OpenSSL or GnuTLS, with more backends likely to appear in the future. Currently, those backend libraries are part of the protocol names used during e.g. the configure stage of a build. Hide those details behind a generically-named declaration for the TLS protocol to avoid leaking those details into the configuration stage.
| * network: prevent SIGPIPE on OSXwm42015-05-31
| | | | | | | | | | | | | | | | OSX does not know MSG_NOSIGNAL. BSD (which OSX is based on) has got the socket option SO_NOSIGPIPE (even if modern BSDs also support MSG_NOSIGNAL). Signed-off-by: Martin Storsjö <martin@martin.st>
| * lavf: move TLS-related ifdeffery to library specific fileswm42015-05-26
| | | | | | | | | | | | There is no need to have this mess in network.c. Signed-off-by: Martin Storsjö <martin@martin.st>
* | libavformat/tcp: fix return code for tcp_acceptSimon Thelen2017-05-10
| | | | | | | | | | | | | | | | | | ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or undefined), return ret instead and return ff_neterror() in ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on Windows. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavformat/network: use defined constant in pollZhao Zhili2016-01-29
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavf/network: split ff_listen_bind into ff_listen and ff_acceptStephan Holljes2015-08-01
| | | | | | | | Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
* | network: prevent SIGPIPE on OSXwm42015-05-30
| | | | | | | | | | | | | | OSX does not know MSG_NOSIGNAL, and provides its own non-standard mechanism instead. I guess Apple hates standards. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | network: Move variable declaration under an #ifTimothy Gu2015-05-28
| | | | | | | | | | | | Avoids an unused variable warning. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf: move TLS-related ifdeffery to library specific fileswm42015-05-27
| | | | | | | | | | | | There is no need to have this mess in network.c. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | network: Do not leave context locked on errorVittorio Giovara2015-04-23
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/network: Check for av_malloc* failures in ff_tls_init()Michael Niedermayer2015-02-03
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf: Use av_gettime_relative()Olivier Langlois2014-05-17
| | | | | | | | | | | | | | | | | | Whenever av_gettime() is used to measure relative period of time, av_gettime_relative() is prefered as it guarantee monotonic time on supported platforms. Signed-off-by: Olivier Langlois <olivier@trillion01.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/network: use av_malloc_array()Michael Niedermayer2014-04-13
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/network: check ff_socket_nonblock() return and print a debug messageMichael Niedermayer2013-12-13
| | | | | | | | | | | | | | Fixes CID1026744 Fixes CID1026743 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/network: check for fcntl() failure in ff_socket()Michael Niedermayer2013-10-20
| | | | | | | | | | Fixes: CID1087075 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/network: fix duplicate includeMichael Niedermayer2013-09-21
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat: remove duplicate includesMichael Niedermayer2013-09-21
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Reinstate proper FFmpeg license for all files.Thilo Borgmann2013-08-30
| |
* | Merge commit '9d5ec50ead97e088d77317e77b18cef06cb3d053'Michael Niedermayer2013-08-10
|\| | | | | | | | | | | | | | | | | | | * commit '9d5ec50ead97e088d77317e77b18cef06cb3d053': ff_socket: put out-of-line and fallback to fcntl() for close-on-exec Conflicts: libavformat/network.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * ff_socket: put out-of-line and fallback to fcntl() for close-on-execRémi Denis-Courmont2013-08-09
| | | | | | | | | | | | | | This supports non-Linux systems (SOCK_CLOEXEC is non-standard) and older Linux kernels to the extent possible. Signed-off-by: Martin Storsjö <martin@martin.st>
* | Merge commit 'abe5268c3328bf0e8fcfb7dc6e231b8920177c3a'Michael Niedermayer2013-08-06
|\| | | | | | | | | | | | | | | | | | | * commit 'abe5268c3328bf0e8fcfb7dc6e231b8920177c3a': tcp: Use a different log message and level if there's more addresses to try Conflicts: libavformat/tcp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * tcp: Use a different log message and level if there's more addresses to tryMartin Storsjö2013-08-06
| | | | | | | | | | | | | | | | | | This lowers the level of warnings printed if trying to connect to a host name that provides both v6 and v4 addresses but the service only is available on the v4 address (often occurring for 'localhost', with servers that aren't v6-aware). Signed-off-by: Martin Storsjö <martin@martin.st>
* | ff_network_wait_fd_timeout(): check for interrupt before operationAndrey Utkin2013-07-12
| | | | | | | | | | Reviewed-by: Lukasz M <lukasz.m.luki@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | ff_network_wait_fd_timeout: do not break with timeout < 0Michael Niedermayer2013-07-06
| | | | | | | | | | | | Most code treats timeout < 0 like 0 already Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'ec7c51c7868d3ccc66b5cc38bf126258b94f086c'Michael Niedermayer2013-06-16
|\| | | | | | | | | | | | | | | | | | | | | * commit 'ec7c51c7868d3ccc66b5cc38bf126258b94f086c': avf: move ff_http_match_no_proxy to network Conflicts: libavformat/internal.h libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * avf: move ff_http_match_no_proxy to networkLuca Barbato2013-06-16
| | | | | | | | It is only used by network protocols.
* | avformat/network: remove unused variableMichael Niedermayer2013-06-05
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '9835abb6d63fb07613994ae90e72fef758149408'Michael Niedermayer2013-06-05
|\| | | | | | | | | | | | | | | | | | | | | * commit '9835abb6d63fb07613994ae90e72fef758149408': network: uniform ff_listen_bind and ff_listen_connect Conflicts: libavformat/network.c libavformat/tcp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * network: uniform ff_listen_bind and ff_listen_connectLuca Barbato2013-06-04
| | | | | | | | | | Document the functions and have both use a millisecond timeout and check for interrupt.
* | avformat/network: check the return value from setsockopt()Michael Niedermayer2013-06-03
| | | | | | | | | | Fixes: CID1026742 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2013-06-02
|\| | | | | | | | | | | | | | | | | | | | | * qatar/master: network: factor out connect-listening code Conflicts: libavformat/network.h libavformat/tcp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * network: factor out connect-listening codeLuca Barbato2013-06-01
| | | | | | | | | | Introduce ff_listen_connect, to be shared with the other non-tcp network protocols.
* | Merge commit '28306e6d620c109ddd672f7243adfbc2bbb3b18f'Michael Niedermayer2013-06-02
|\| | | | | | | | | | | | | | | | | | | | | * commit '28306e6d620c109ddd672f7243adfbc2bbb3b18f': network: factor out bind-listening code use my full first name instead of short one in copyrights Conflicts: libavformat/tcp.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * network: factor out bind-listening codeLuca Barbato2013-06-01
| | | | | | | | | | Introduce ff_listen_bind, to be shared with the other non-tcp network protocols.