On Mon, 8 Apr 2024 at 16:26, Zhao Zhili <quinkbl...@foxmail.com> wrote:

> From: Zhao Zhili <zhiliz...@tencent.com>
>
> This fix rtmps failure since rtmps requires nonblocking read.
>
> Signed-off-by: Zhao Zhili <zhiliz...@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
>

Are other TLS layers affected, say OpenSSL, etc?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to