[FFmpeg-devel] [PATCH 08/18] avformat/tls: move openssl specific init out of generic code

Timo Rothenpieler timo at rothenpieler.org
Thu Jul 3 17:24:05 EEST 2025


On 03.07.2025 03:07, Jack Lau wrote:
> 
> 
>> On Jul 3, 2025, at 00:56, Timo Rothenpieler <timo at rothenpieler.org> wrote:
>>
>> ---
>> libavformat/tls.c         | 9 ---------
>> libavformat/tls_openssl.c | 3 +++
>> 2 files changed, 3 insertions(+), 9 deletions(-)
>>
>> diff --git a/libavformat/tls.c b/libavformat/tls.c
>> index 5ec4cca58a..f888970969 100644
>> --- a/libavformat/tls.c
>> +++ b/libavformat/tls.c
>> @@ -135,15 +135,6 @@ int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AV
>>      ret = ffurl_open_whitelist(c->is_dtls ? &c->udp : &c->tcp, buf, AVIO_FLAG_READ_WRITE,
>>                                 &parent->interrupt_callback, options,
>>                                 parent->protocol_whitelist, parent->protocol_blacklist, parent);
>> -    if (c->is_dtls) {
>> -        if (ret < 0) {
>> -            av_log(c, AV_LOG_ERROR, "Failed to open udp://%s:%d\n", c->underlying_host, port);
>> -            return ret;
>> -        }
>> -        /* Make the socket non-blocking, set to READ and WRITE mode after connected */
>> -        ff_socket_nonblock(ffurl_get_file_handle(c->udp), 1);
>> -        c->udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_NONBLOCK;
>> -    }
>>      return ret;
>> }
>>
>> diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
>> index 2a3905891d..d83fe602d5 100644
>> --- a/libavformat/tls_openssl.c
>> +++ b/libavformat/tls_openssl.c
>> @@ -985,6 +985,9 @@ static int dtls_start(URLContext *h, const char *url, int flags, AVDictionary **
>>              av_log(p, AV_LOG_ERROR, "Failed to connect %s\n", url);
>>              return ret;
>>          }
>> +        /* Make the socket non-blocking, set to READ and WRITE mode after connected */
>> +        ff_socket_nonblock(ffurl_get_file_handle(p->tls_shared.udp), 1);
>> +        p->tls_shared.udp->flags |= AVIO_FLAG_READ | AVIO_FLAG_NONBLOCK;
> Since AVIO_FLAG_READ_WRITE was flagged, it can be just "p->tls_shared.udp->flags |= AVIO_FLAG_NONBLOCK;”

Isn't that redundant with ff_socket_nonblock right above it as well?

>>      }
>>
>>      /* Setup DTLS as passive, which is server role. */
>> -- 
>> 2.49.0
>>
>> _______________________________________________
>> 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”.
> Thanks
> 
> _______________________________________________
> 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