Commit 65c1c83c authored by Zhao Zhili's avatar Zhao Zhili

avformat/tls_mbedtls: Pass FLAG_NONBLOCK to underlying transport

This fix rtmps failure since rtmps requires nonblocking read.
Signed-off-by: 's avatarZhao Zhili <zhilizhao@tencent.com>
parent 2a7d622d
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment