[FFmpeg-devel] libavformat/http.c: add the protection about the http seek implement

Submitted by shenqichao on Oct. 30, 2018, 2:01 a.m.

Details

Message ID 20181030020127.45708-1-qichaoshen@163.com
State New
Headers show

Commit Message

shenqichao Oct. 30, 2018, 2:01 a.m.
If a http resource is not streamed, it can seek to the end of this resouce.

I add the detail information at https://trac.ffmpeg.org/ticket/6885

Fixes ticket #6885.

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

Comments

shenqichao Nov. 7, 2018, 11:11 a.m.
what about the progress of this patch ?







At 2018-10-30 10:01:27, "shenqichao" <qichaoshen@163.com> wrote:
>If a http resource is not streamed, it can seek to the end of this resouce.
>
>I add the detail information at https://trac.ffmpeg.org/ticket/6885
>
>Fixes ticket #6885.
>
>Signed-off-by: shenqichao <qichaoshen@163.com>
>---
> libavformat/http.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/libavformat/http.c b/libavformat/http.c
>index 3a35bc7eac..9401a5c63e 100644
>--- a/libavformat/http.c
>+++ b/libavformat/http.c
>@@ -1669,7 +1669,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 || (h->is_streamed == 0 &&  whence == SEEK_SET && off == s->filesize))
>         return s->filesize;
>     else if (!force_reconnect &&
>              ((whence == SEEK_CUR && off == 0) ||
>-- 
>2.19.0
>
>
>_______________________________________________
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Patch hide | download patch | download mbox

diff --git a/libavformat/http.c b/libavformat/http.c
index 3a35bc7eac..9401a5c63e 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -1669,7 +1669,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 || (h->is_streamed == 0 &&  whence == SEEK_SET && off == s->filesize))
         return s->filesize;
     else if (!force_reconnect &&
              ((whence == SEEK_CUR && off == 0) ||