[FFmpeg-devel] [PATCH V2 2/2] lavf/tls_openssl: support both pre-1.1.0 and post-1.1.0 init

Jun Zhao mypopydev at gmail.com
Wed Dec 11 04:02:10 EET 2019


From: Jun Zhao <barryjzhao at tencent.com>

supporting both pre-1.1.0 and post-1.1.0 version of the OpenSSL
library as the link:
https://wiki.openssl.org/index.php/Library_Initialization

Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
---
 libavformat/tls_openssl.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 7ae71bd..53f8363 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -70,8 +70,15 @@ int ff_openssl_init(void)
 {
     ff_lock_avformat();
     if (!openssl_init) {
+        /* OpenSSL 1.0.2 or below, then you would use SSL_library_init. If you are
+         * using OpenSSL 1.1.0 or above, then the library will initialize
+         * itself automatically.
+         * https://wiki.openssl.org/index.php/Library_Initialization
+         */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
         SSL_library_init();
         SSL_load_error_strings();
+#endif
 #if HAVE_THREADS
         if (!CRYPTO_get_locking_callback()) {
             int i;
-- 
1.7.1



More information about the ffmpeg-devel mailing list