[FFmpeg-devel] [PATCH] avformat/tls_mbedtls: Pass FLAG_NONBLOCK to underlying transport
Zhao Zhili
quinkblack at foxmail.com
Thu Apr 11 15:19:58 EEST 2024
> On Apr 8, 2024, at 21:26, Zhao Zhili <quinkblack at foxmail.com> wrote:
>
> From: Zhao Zhili <zhilizhao at tencent.com>
>
> This fix rtmps failure since rtmps requires nonblocking read.
>
> Signed-off-by: Zhao Zhili <zhilizhao at tencent.com>
> ---
> libavformat/tls_mbedtls.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
> index 8503523b6d..f51cf43b1c 100644
> --- a/libavformat/tls_mbedtls.c
> +++ b/libavformat/tls_mbedtls.c
> @@ -309,6 +309,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;
> @@ -322,6 +324,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;
> --
> 2.25.1
Will apply tomorrow.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list