diff mbox series

[FFmpeg-devel] tls: Hook up the url_get_short_seek function in the TLS backends

Message ID 20201029195920.20328-1-martin@martin.st
State Accepted
Commit 70d8077b795766e2486e6ec8110f22a97362d6d6
Headers show
Series [FFmpeg-devel] tls: Hook up the url_get_short_seek function in the TLS backends | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Martin Storsjö Oct. 29, 2020, 7:59 p.m. UTC
This makes sure that small seeks forward on https don't end up
doing new requests.
---
 libavformat/tls_gnutls.c          | 7 +++++++
 libavformat/tls_libtls.c          | 7 +++++++
 libavformat/tls_mbedtls.c         | 7 +++++++
 libavformat/tls_openssl.c         | 7 +++++++
 libavformat/tls_schannel.c        | 7 +++++++
 libavformat/tls_securetransport.c | 7 +++++++
 6 files changed, 42 insertions(+)

Comments

Andreas Rheinhardt Oct. 29, 2020, 8:20 p.m. UTC | #1
Martin Storsjö:
> This makes sure that small seeks forward on https don't end up
> doing new requests.
> ---
>  libavformat/tls_gnutls.c          | 7 +++++++
>  libavformat/tls_libtls.c          | 7 +++++++
>  libavformat/tls_mbedtls.c         | 7 +++++++
>  libavformat/tls_openssl.c         | 7 +++++++
>  libavformat/tls_schannel.c        | 7 +++++++
>  libavformat/tls_securetransport.c | 7 +++++++
>  6 files changed, 42 insertions(+)
> 
> diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
> index 0c4ef34f5f..f9d5af7096 100644
> --- a/libavformat/tls_gnutls.c
> +++ b/libavformat/tls_gnutls.c
> @@ -269,6 +269,12 @@ static int tls_get_file_handle(URLContext *h)
>      return ffurl_get_file_handle(c->tls_shared.tcp);
>  }
>  
> +static int tls_get_short_seek(URLContext *h)
> +{
> +    TLSContext *s = h->priv_data;
> +    return ffurl_get_short_seek(s->tls_shared.tcp);
> +}
> +
>  static const AVOption options[] = {
>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>      { NULL }
> @@ -288,6 +294,7 @@ const URLProtocol ff_tls_protocol = {
>      .url_write      = tls_write,
>      .url_close      = tls_close,
>      .url_get_file_handle = tls_get_file_handle,
> +    .url_get_short_seek  = tls_get_short_seek,
>      .priv_data_size = sizeof(TLSContext),
>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>      .priv_data_class = &tls_class,
> diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c
> index dff7f2d9fb..911c8094b0 100644
> --- a/libavformat/tls_libtls.c
> +++ b/libavformat/tls_libtls.c
> @@ -181,6 +181,12 @@ static int tls_get_file_handle(URLContext *h)
>      return ffurl_get_file_handle(c->tls_shared.tcp);
>  }
>  
> +static int tls_get_short_seek(URLContext *h)
> +{
> +    TLSContext *s = h->priv_data;
> +    return ffurl_get_short_seek(s->tls_shared.tcp);
> +}
> +
>  static const AVOption options[] = {
>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>      { NULL }
> @@ -200,6 +206,7 @@ const URLProtocol ff_tls_protocol = {
>      .url_write      = ff_tls_write,
>      .url_close      = ff_tls_close,
>      .url_get_file_handle = tls_get_file_handle,
> +    .url_get_short_seek  = tls_get_short_seek,
>      .priv_data_size = sizeof(TLSContext),
>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>      .priv_data_class = &tls_class,
> diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
> index 965adf1be4..aadf17760d 100644
> --- a/libavformat/tls_mbedtls.c
> +++ b/libavformat/tls_mbedtls.c
> @@ -326,6 +326,12 @@ static int tls_get_file_handle(URLContext *h)
>      return ffurl_get_file_handle(c->tls_shared.tcp);
>  }
>  
> +static int tls_get_short_seek(URLContext *h)
> +{
> +    TLSContext *s = h->priv_data;
> +    return ffurl_get_short_seek(s->tls_shared.tcp);
> +}
> +
>  static const AVOption options[] = {
>      TLS_COMMON_OPTIONS(TLSContext, tls_shared), \
>      {"key_password", "Password for the private key file", OFFSET(priv_key_pw),  AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
> @@ -346,6 +352,7 @@ const URLProtocol ff_tls_protocol = {
>      .url_write      = tls_write,
>      .url_close      = tls_close,
>      .url_get_file_handle = tls_get_file_handle,
> +    .url_get_short_seek  = tls_get_short_seek,
>      .priv_data_size = sizeof(TLSContext),
>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>      .priv_data_class = &tls_class,
> diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
> index 002197fa76..e0616acbc8 100644
> --- a/libavformat/tls_openssl.c
> +++ b/libavformat/tls_openssl.c
> @@ -351,6 +351,12 @@ static int tls_get_file_handle(URLContext *h)
>      return ffurl_get_file_handle(c->tls_shared.tcp);
>  }
>  
> +static int tls_get_short_seek(URLContext *h)
> +{
> +    TLSContext *s = h->priv_data;
> +    return ffurl_get_short_seek(s->tls_shared.tcp);
> +}
> +
>  static const AVOption options[] = {
>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>      { NULL }
> @@ -370,6 +376,7 @@ const URLProtocol ff_tls_protocol = {
>      .url_write      = tls_write,
>      .url_close      = tls_close,
>      .url_get_file_handle = tls_get_file_handle,
> +    .url_get_short_seek  = tls_get_short_seek,
>      .priv_data_size = sizeof(TLSContext),
>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>      .priv_data_class = &tls_class,
> diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
> index 4bfaa85228..d4959f75fa 100644
> --- a/libavformat/tls_schannel.c
> +++ b/libavformat/tls_schannel.c
> @@ -589,6 +589,12 @@ static int tls_get_file_handle(URLContext *h)
>      return ffurl_get_file_handle(c->tls_shared.tcp);
>  }
>  
> +static int tls_get_short_seek(URLContext *h)
> +{
> +    TLSContext *s = h->priv_data;
> +    return ffurl_get_short_seek(s->tls_shared.tcp);
> +}
> +
>  static const AVOption options[] = {
>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>      { NULL }
> @@ -608,6 +614,7 @@ const URLProtocol ff_tls_protocol = {
>      .url_write      = tls_write,
>      .url_close      = tls_close,
>      .url_get_file_handle = tls_get_file_handle,
> +    .url_get_short_seek  = tls_get_short_seek,
>      .priv_data_size = sizeof(TLSContext),
>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>      .priv_data_class = &tls_class,
> diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c
> index 3250b23051..b0cfab1e23 100644
> --- a/libavformat/tls_securetransport.c
> +++ b/libavformat/tls_securetransport.c
> @@ -396,6 +396,12 @@ static int tls_get_file_handle(URLContext *h)
>      return ffurl_get_file_handle(c->tls_shared.tcp);
>  }
>  
> +static int tls_get_short_seek(URLContext *h)
> +{
> +    TLSContext *s = h->priv_data;
> +    return ffurl_get_short_seek(s->tls_shared.tcp);
> +}
> +
>  static const AVOption options[] = {
>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>      { NULL }
> @@ -415,6 +421,7 @@ const URLProtocol ff_tls_protocol = {
>      .url_write      = tls_write,
>      .url_close      = tls_close,
>      .url_get_file_handle = tls_get_file_handle,
> +    .url_get_short_seek  = tls_get_short_seek,
>      .priv_data_size = sizeof(TLSContext),
>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>      .priv_data_class = &tls_class,
> 
All the TLSContexts begin with a common initial sequence, namely
    const AVClass *class;
    TLSShared tls_shared;
So using different functions for them is avoidable.

- Andreas
Martin Storsjö Oct. 29, 2020, 8:39 p.m. UTC | #2
On Thu, 29 Oct 2020, Andreas Rheinhardt wrote:

> Martin Storsjö:
>> This makes sure that small seeks forward on https don't end up
>> doing new requests.
>> ---
>>  libavformat/tls_gnutls.c          | 7 +++++++
>>  libavformat/tls_libtls.c          | 7 +++++++
>>  libavformat/tls_mbedtls.c         | 7 +++++++
>>  libavformat/tls_openssl.c         | 7 +++++++
>>  libavformat/tls_schannel.c        | 7 +++++++
>>  libavformat/tls_securetransport.c | 7 +++++++
>>  6 files changed, 42 insertions(+)
>> 
> All the TLSContexts begin with a common initial sequence, namely
>    const AVClass *class;
>    TLSShared tls_shared;
> So using different functions for them is avoidable.

Yes - and that would also go for the preexisting url_get_file_handle that 
works pretty much the same as this one. It requires a bit more blind 
casting (no easy verification if one backend would have a different layout 
for its context) though...

// Martin
Martin Storsjö Nov. 4, 2020, 1:31 p.m. UTC | #3
On Thu, 29 Oct 2020, Andreas Rheinhardt wrote:

> Martin Storsjö:
>> This makes sure that small seeks forward on https don't end up
>> doing new requests.
>> ---
>>  libavformat/tls_gnutls.c          | 7 +++++++
>>  libavformat/tls_libtls.c          | 7 +++++++
>>  libavformat/tls_mbedtls.c         | 7 +++++++
>>  libavformat/tls_openssl.c         | 7 +++++++
>>  libavformat/tls_schannel.c        | 7 +++++++
>>  libavformat/tls_securetransport.c | 7 +++++++
>>  6 files changed, 42 insertions(+)
>> 
>> diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
>> index 0c4ef34f5f..f9d5af7096 100644
>> --- a/libavformat/tls_gnutls.c
>> +++ b/libavformat/tls_gnutls.c
>> @@ -269,6 +269,12 @@ static int tls_get_file_handle(URLContext *h)
>>      return ffurl_get_file_handle(c->tls_shared.tcp);
>>  }
>> 
>> +static int tls_get_short_seek(URLContext *h)
>> +{
>> +    TLSContext *s = h->priv_data;
>> +    return ffurl_get_short_seek(s->tls_shared.tcp);
>> +}
>> +
>>  static const AVOption options[] = {
>>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>>      { NULL }
>> @@ -288,6 +294,7 @@ const URLProtocol ff_tls_protocol = {
>>      .url_write      = tls_write,
>>      .url_close      = tls_close,
>>      .url_get_file_handle = tls_get_file_handle,
>> +    .url_get_short_seek  = tls_get_short_seek,
>>      .priv_data_size = sizeof(TLSContext),
>>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>>      .priv_data_class = &tls_class,
>> diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c
>> index dff7f2d9fb..911c8094b0 100644
>> --- a/libavformat/tls_libtls.c
>> +++ b/libavformat/tls_libtls.c
>> @@ -181,6 +181,12 @@ static int tls_get_file_handle(URLContext *h)
>>      return ffurl_get_file_handle(c->tls_shared.tcp);
>>  }
>> 
>> +static int tls_get_short_seek(URLContext *h)
>> +{
>> +    TLSContext *s = h->priv_data;
>> +    return ffurl_get_short_seek(s->tls_shared.tcp);
>> +}
>> +
>>  static const AVOption options[] = {
>>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>>      { NULL }
>> @@ -200,6 +206,7 @@ const URLProtocol ff_tls_protocol = {
>>      .url_write      = ff_tls_write,
>>      .url_close      = ff_tls_close,
>>      .url_get_file_handle = tls_get_file_handle,
>> +    .url_get_short_seek  = tls_get_short_seek,
>>      .priv_data_size = sizeof(TLSContext),
>>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>>      .priv_data_class = &tls_class,
>> diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
>> index 965adf1be4..aadf17760d 100644
>> --- a/libavformat/tls_mbedtls.c
>> +++ b/libavformat/tls_mbedtls.c
>> @@ -326,6 +326,12 @@ static int tls_get_file_handle(URLContext *h)
>>      return ffurl_get_file_handle(c->tls_shared.tcp);
>>  }
>> 
>> +static int tls_get_short_seek(URLContext *h)
>> +{
>> +    TLSContext *s = h->priv_data;
>> +    return ffurl_get_short_seek(s->tls_shared.tcp);
>> +}
>> +
>>  static const AVOption options[] = {
>>      TLS_COMMON_OPTIONS(TLSContext, tls_shared), \
>>      {"key_password", "Password for the private key file", OFFSET(priv_key_pw),  AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
>> @@ -346,6 +352,7 @@ const URLProtocol ff_tls_protocol = {
>>      .url_write      = tls_write,
>>      .url_close      = tls_close,
>>      .url_get_file_handle = tls_get_file_handle,
>> +    .url_get_short_seek  = tls_get_short_seek,
>>      .priv_data_size = sizeof(TLSContext),
>>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>>      .priv_data_class = &tls_class,
>> diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
>> index 002197fa76..e0616acbc8 100644
>> --- a/libavformat/tls_openssl.c
>> +++ b/libavformat/tls_openssl.c
>> @@ -351,6 +351,12 @@ static int tls_get_file_handle(URLContext *h)
>>      return ffurl_get_file_handle(c->tls_shared.tcp);
>>  }
>> 
>> +static int tls_get_short_seek(URLContext *h)
>> +{
>> +    TLSContext *s = h->priv_data;
>> +    return ffurl_get_short_seek(s->tls_shared.tcp);
>> +}
>> +
>>  static const AVOption options[] = {
>>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>>      { NULL }
>> @@ -370,6 +376,7 @@ const URLProtocol ff_tls_protocol = {
>>      .url_write      = tls_write,
>>      .url_close      = tls_close,
>>      .url_get_file_handle = tls_get_file_handle,
>> +    .url_get_short_seek  = tls_get_short_seek,
>>      .priv_data_size = sizeof(TLSContext),
>>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>>      .priv_data_class = &tls_class,
>> diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
>> index 4bfaa85228..d4959f75fa 100644
>> --- a/libavformat/tls_schannel.c
>> +++ b/libavformat/tls_schannel.c
>> @@ -589,6 +589,12 @@ static int tls_get_file_handle(URLContext *h)
>>      return ffurl_get_file_handle(c->tls_shared.tcp);
>>  }
>> 
>> +static int tls_get_short_seek(URLContext *h)
>> +{
>> +    TLSContext *s = h->priv_data;
>> +    return ffurl_get_short_seek(s->tls_shared.tcp);
>> +}
>> +
>>  static const AVOption options[] = {
>>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>>      { NULL }
>> @@ -608,6 +614,7 @@ const URLProtocol ff_tls_protocol = {
>>      .url_write      = tls_write,
>>      .url_close      = tls_close,
>>      .url_get_file_handle = tls_get_file_handle,
>> +    .url_get_short_seek  = tls_get_short_seek,
>>      .priv_data_size = sizeof(TLSContext),
>>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>>      .priv_data_class = &tls_class,
>> diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c
>> index 3250b23051..b0cfab1e23 100644
>> --- a/libavformat/tls_securetransport.c
>> +++ b/libavformat/tls_securetransport.c
>> @@ -396,6 +396,12 @@ static int tls_get_file_handle(URLContext *h)
>>      return ffurl_get_file_handle(c->tls_shared.tcp);
>>  }
>> 
>> +static int tls_get_short_seek(URLContext *h)
>> +{
>> +    TLSContext *s = h->priv_data;
>> +    return ffurl_get_short_seek(s->tls_shared.tcp);
>> +}
>> +
>>  static const AVOption options[] = {
>>      TLS_COMMON_OPTIONS(TLSContext, tls_shared),
>>      { NULL }
>> @@ -415,6 +421,7 @@ const URLProtocol ff_tls_protocol = {
>>      .url_write      = tls_write,
>>      .url_close      = tls_close,
>>      .url_get_file_handle = tls_get_file_handle,
>> +    .url_get_short_seek  = tls_get_short_seek,
>>      .priv_data_size = sizeof(TLSContext),
>>      .flags          = URL_PROTOCOL_FLAG_NETWORK,
>>      .priv_data_class = &tls_class,
>> 
> All the TLSContexts begin with a common initial sequence, namely
>    const AVClass *class;
>    TLSShared tls_shared;
> So using different functions for them is avoidable.

Andreas later commented on irc, that he hadn't realized that only one TLS 
backend is linked in, in each build, so it doesn't add any real overhead, 
and he'd thus prefer this patch over the alternative I sent later.

So unless there's more comments, I'll push this e.g. tomorrow.

// Martin
diff mbox series

Patch

diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c
index 0c4ef34f5f..f9d5af7096 100644
--- a/libavformat/tls_gnutls.c
+++ b/libavformat/tls_gnutls.c
@@ -269,6 +269,12 @@  static int tls_get_file_handle(URLContext *h)
     return ffurl_get_file_handle(c->tls_shared.tcp);
 }
 
+static int tls_get_short_seek(URLContext *h)
+{
+    TLSContext *s = h->priv_data;
+    return ffurl_get_short_seek(s->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -288,6 +294,7 @@  const URLProtocol ff_tls_protocol = {
     .url_write      = tls_write,
     .url_close      = tls_close,
     .url_get_file_handle = tls_get_file_handle,
+    .url_get_short_seek  = tls_get_short_seek,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_libtls.c b/libavformat/tls_libtls.c
index dff7f2d9fb..911c8094b0 100644
--- a/libavformat/tls_libtls.c
+++ b/libavformat/tls_libtls.c
@@ -181,6 +181,12 @@  static int tls_get_file_handle(URLContext *h)
     return ffurl_get_file_handle(c->tls_shared.tcp);
 }
 
+static int tls_get_short_seek(URLContext *h)
+{
+    TLSContext *s = h->priv_data;
+    return ffurl_get_short_seek(s->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -200,6 +206,7 @@  const URLProtocol ff_tls_protocol = {
     .url_write      = ff_tls_write,
     .url_close      = ff_tls_close,
     .url_get_file_handle = tls_get_file_handle,
+    .url_get_short_seek  = tls_get_short_seek,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index 965adf1be4..aadf17760d 100644
--- a/libavformat/tls_mbedtls.c
+++ b/libavformat/tls_mbedtls.c
@@ -326,6 +326,12 @@  static int tls_get_file_handle(URLContext *h)
     return ffurl_get_file_handle(c->tls_shared.tcp);
 }
 
+static int tls_get_short_seek(URLContext *h)
+{
+    TLSContext *s = h->priv_data;
+    return ffurl_get_short_seek(s->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared), \
     {"key_password", "Password for the private key file", OFFSET(priv_key_pw),  AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
@@ -346,6 +352,7 @@  const URLProtocol ff_tls_protocol = {
     .url_write      = tls_write,
     .url_close      = tls_close,
     .url_get_file_handle = tls_get_file_handle,
+    .url_get_short_seek  = tls_get_short_seek,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c
index 002197fa76..e0616acbc8 100644
--- a/libavformat/tls_openssl.c
+++ b/libavformat/tls_openssl.c
@@ -351,6 +351,12 @@  static int tls_get_file_handle(URLContext *h)
     return ffurl_get_file_handle(c->tls_shared.tcp);
 }
 
+static int tls_get_short_seek(URLContext *h)
+{
+    TLSContext *s = h->priv_data;
+    return ffurl_get_short_seek(s->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -370,6 +376,7 @@  const URLProtocol ff_tls_protocol = {
     .url_write      = tls_write,
     .url_close      = tls_close,
     .url_get_file_handle = tls_get_file_handle,
+    .url_get_short_seek  = tls_get_short_seek,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_schannel.c b/libavformat/tls_schannel.c
index 4bfaa85228..d4959f75fa 100644
--- a/libavformat/tls_schannel.c
+++ b/libavformat/tls_schannel.c
@@ -589,6 +589,12 @@  static int tls_get_file_handle(URLContext *h)
     return ffurl_get_file_handle(c->tls_shared.tcp);
 }
 
+static int tls_get_short_seek(URLContext *h)
+{
+    TLSContext *s = h->priv_data;
+    return ffurl_get_short_seek(s->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -608,6 +614,7 @@  const URLProtocol ff_tls_protocol = {
     .url_write      = tls_write,
     .url_close      = tls_close,
     .url_get_file_handle = tls_get_file_handle,
+    .url_get_short_seek  = tls_get_short_seek,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,
diff --git a/libavformat/tls_securetransport.c b/libavformat/tls_securetransport.c
index 3250b23051..b0cfab1e23 100644
--- a/libavformat/tls_securetransport.c
+++ b/libavformat/tls_securetransport.c
@@ -396,6 +396,12 @@  static int tls_get_file_handle(URLContext *h)
     return ffurl_get_file_handle(c->tls_shared.tcp);
 }
 
+static int tls_get_short_seek(URLContext *h)
+{
+    TLSContext *s = h->priv_data;
+    return ffurl_get_short_seek(s->tls_shared.tcp);
+}
+
 static const AVOption options[] = {
     TLS_COMMON_OPTIONS(TLSContext, tls_shared),
     { NULL }
@@ -415,6 +421,7 @@  const URLProtocol ff_tls_protocol = {
     .url_write      = tls_write,
     .url_close      = tls_close,
     .url_get_file_handle = tls_get_file_handle,
+    .url_get_short_seek  = tls_get_short_seek,
     .priv_data_size = sizeof(TLSContext),
     .flags          = URL_PROTOCOL_FLAG_NETWORK,
     .priv_data_class = &tls_class,