diff mbox series

[FFmpeg-devel,1/1] avformat/http: handle SEEK_SET to filesize

Message ID 20200424110913.47435-2-hello.vectronic@gmail.com
State Withdrawn
Headers show
Series avformat/http: handle SEEK_SET to filesize and fix #6885 | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

vectronic April 24, 2020, 11:09 a.m. UTC
if whence == SEEK_SET and offset is filesize and is_streamable is false
we can just return the filesize to prevent an HTTP 416 error

Signed-off-by: vectronic <hello.vectronic@gmail.com>
---
 libavformat/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

vectronic April 24, 2020, 11:45 a.m. UTC | #1
> On 24 Apr 2020, at 12:09, vectronic <hello.vectronic@gmail.com> wrote:
> 
> if whence == SEEK_SET and offset is filesize and is_streamable is false
> we can just return the filesize to prevent an HTTP 416 error
> 
> Signed-off-by: vectronic <hello.vectronic@gmail.com>
> ---
> libavformat/http.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index c9415578aa..1adcc6eb67 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -1719,7 +1719,7 @@ static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
>     int old_buf_size, ret;
>     AVDictionary *options = NULL;
> 
> -    if (whence == AVSEEK_SIZE)
> +    if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 0 && off == s->filesize))
>         return s->filesize;
>     else if (!force_reconnect &&
>              ((whence == SEEK_CUR && off == 0) ||
> -- 
> 2.24.2 (Apple Git-127)
> 

Apologies for confusion on this, I believe this issue has already been fixed this commit:

https://github.com/FFmpeg/FFmpeg/commit/69fcc093c1241b5ee7711c56c9cd558832a7e491 <https://github.com/FFmpeg/FFmpeg/commit/69fcc093c1241b5ee7711c56c9cd558832a7e491>

Therefore I believe the following has already been fixed and can be closed:

https://trac.ffmpeg.org/ticket/6885 <https://trac.ffmpeg.org/ticket/6885>
diff mbox series

Patch

diff --git a/libavformat/http.c b/libavformat/http.c
index c9415578aa..1adcc6eb67 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1719,7 +1719,7 @@  static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int fo
     int old_buf_size, ret;
     AVDictionary *options = NULL;
 
-    if (whence == AVSEEK_SIZE)
+    if ((whence == AVSEEK_SIZE) || (whence == SEEK_SET && h->is_streamed == 0 && off == s->filesize))
         return s->filesize;
     else if (!force_reconnect &&
              ((whence == SEEK_CUR && off == 0) ||