Skip to content

Commit b270faa

Browse files
committed
avformat/tls_openssl: fix build error when openssl is 1.1.0
Openssl 1.1.0 version haven't DTLS_get_data_mtu API It's no necessary manual compute the real overhead for OpenSSL 1.1.0 version. So this patch gives a conservative overhead 64 bytes covers all cases. Signed-off-by: Jack Lau <[email protected]>
1 parent 9faae03 commit b270faa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libavformat/tls_openssl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,13 +1007,17 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
10071007
URLContext *uc = c->tls_shared.is_dtls ? c->tls_shared.udp
10081008
: c->tls_shared.tcp;
10091009
int ret;
1010-
1010+
#if OPENSSL_VERSION_NUMBER >= 0x10101000L // OpenSSL 1.1.1
1011+
int data_mtu = DTLS_get_data_mtu(c->ssl);
1012+
#else
1013+
int data_mtu = s->mtu - 64; // Conservative overhead covers all cases
1014+
#endif
10111015
// Set or clear the AVIO_FLAG_NONBLOCK on c->tls_shared.tcp
10121016
uc->flags &= ~AVIO_FLAG_NONBLOCK;
10131017
uc->flags |= h->flags & AVIO_FLAG_NONBLOCK;
10141018

10151019
if (c->tls_shared.is_dtls)
1016-
size = FFMIN(size, DTLS_get_data_mtu(c->ssl));
1020+
size = FFMIN(size, data_mtu);
10171021

10181022
ret = SSL_write(c->ssl, buf, size);
10191023
if (ret > 0)

0 commit comments

Comments
 (0)