Changes between Initial Version and Version 1 of Ticket #6885, comment 15


Ignore:
Timestamp:
Oct 29, 2018, 11:56:03 PM (8 months ago)
Author:
cehoyos
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6885, comment 15

    initial v1  
    77If a XXX.mp4 is a local file and the size is 200,420,354, we call avio_seek(AVIOContext *s, int64_t offset, int whence) by whence = SEEK_SET and offset=200,420,354, it finally call the following code:
    88
    9 /////////////////////////////////////////////
     9{{{
    1010/* XXX: use llseek */
    1111static int64_t file_seek(URLContext *h, int64_t pos, int whence)
     
    2424    return ret < 0 ? AVERROR(errno) : ret;
    2525}
    26 /////////////////////////////////////////////
     26}}}
    2727And it return 200,420,354.
    2828
    2929But if the same file at a HTTP Server, we call avio_seek(AVIOContext *s, int64_t offset, int whence) by whence = SEEK_SET and offset=200,420,354, it finally call the following code:
    30 ////////////////////////////////////////////
     30{{{
    3131static int64_t http_seek_internal(URLContext *h, int64_t off, int whence, int force_reconnect)
    3232{
     
    8080}
    8181
    82 ////////////////////////////////////////////
     82}}}
    8383and it return fail, because the HTTP Server return 416 as following:
    8484
     
    8888Consider that some http resource is streamed, the file size of the resource is undefined or changing, and we should except it.
    8989So the modification can be 
    90 
     90{{{
    9191    if ((whence == AVSEEK_SIZE) || (h->is_streamed ==0 && whence == SEEK_SET && off == s->filesize))
    9292        return s->filesize;
    9393
     94}}}
    9495
    9596
    96