avformat/tls_mbedtls: Pass FLAG_NONBLOCK to underlying transport

This fix rtmps failure since rtmps requires nonblocking read.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
release/7.1
Zhao Zhili 9 months ago
parent 2a7d622ddd
commit 65c1c83ca4
  1. 4
      libavformat/tls_mbedtls.c

@ -310,6 +310,8 @@ static int tls_read(URLContext *h, uint8_t *buf, int size)
TLSContext *tls_ctx = h->priv_data;
int ret;
tls_ctx->tls_shared.tcp->flags &= ~AVIO_FLAG_NONBLOCK;
tls_ctx->tls_shared.tcp->flags |= h->flags & AVIO_FLAG_NONBLOCK;
if ((ret = mbedtls_ssl_read(&tls_ctx->ssl_context, buf, size)) > 0) {
// return read length
return ret;
@ -323,6 +325,8 @@ static int tls_write(URLContext *h, const uint8_t *buf, int size)
TLSContext *tls_ctx = h->priv_data;
int ret;
tls_ctx->tls_shared.tcp->flags &= ~AVIO_FLAG_NONBLOCK;
tls_ctx->tls_shared.tcp->flags |= h->flags & AVIO_FLAG_NONBLOCK;
if ((ret = mbedtls_ssl_write(&tls_ctx->ssl_context, buf, size)) > 0) {
// return written length
return ret;

Loading…
Cancel
Save