Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2018-01-16 14:57:04 +0300
committerwm4 <nfxjfg@googlemail.com>2018-01-16 14:57:04 +0300
commit631c56a8e46dea41585f3e7b3ef9c52b49faa385 (patch)
tree12294edd1f95322624f5bc3a4cda392353da2e46 /libavformat/network.c
parent6512ff72f9cc058e27646604caeacc4ef0dbd93e (diff)
avformat: make avformat_network_init() explicitly optional
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.
Diffstat (limited to 'libavformat/network.c')
-rw-r--r--libavformat/network.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/libavformat/network.c b/libavformat/network.c
index e9eb4b443a..d5c82e9ab9 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -54,20 +54,11 @@ void ff_tls_deinit(void)
#endif
}
-int ff_network_inited_globally;
-
int ff_network_init(void)
{
#if HAVE_WINSOCK2_H
WSADATA wsaData;
-#endif
- if (!ff_network_inited_globally)
- av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
- "network initialization. Please use "
- "avformat_network_init(), this will "
- "become mandatory later.\n");
-#if HAVE_WINSOCK2_H
if (WSAStartup(MAKEWORD(1,1), &wsaData))
return 0;
#endif