[FFmpeg-cvslog] avformat/tls_mbedtls: Pass FLAG_NONBLOCK to underlying transport
Zhao Zhili
git at videolan.org
Fri Apr 12 10:33:50 EEST 2024
ffmpeg | branch: master | Zhao Zhili <zhilizhao at tencent.com> | Mon Apr 8 21:26:13 2024 +0800| [65c1c83ca42540415516c37e21c9aeb7dd2c96d1] | committer: Zhao Zhili
avformat/tls_mbedtls: Pass FLAG_NONBLOCK to underlying transport
This fix rtmps failure since rtmps requires nonblocking read.
Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65c1c83ca42540415516c37e21c9aeb7dd2c96d1
---
libavformat/tls_mbedtls.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index 59ed4b447a..1a182e735e 100644
--- a/libavformat/tls_mbedtls.c
+++ b/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;
More information about the ffmpeg-cvslog
mailing list