Revision 8c68f25b

View differences:

libavformat/avidec.c
955 955
    int i;
956 956
    int64_t last_start=0;
957 957
    int64_t first_end= INT64_MAX;
958
    int64_t oldpos= url_ftell(s->pb);
958 959

  
959 960
    for(i=0; i<s->nb_streams; i++){
960 961
        AVStream *st = s->streams[i];
961 962
        int n= st->nb_index_entries;
963
        unsigned int size;
962 964

  
963 965
        if(n <= 0)
964 966
            continue;
965 967

  
968
        if(n >= 2){
969
            int64_t pos= st->index_entries[0].pos;
970
            url_fseek(s->pb, pos + 4, SEEK_SET);
971
            size= get_le32(s->pb);
972
            if(pos + size > st->index_entries[1].pos)
973
                last_start= INT64_MAX;
974
        }
975

  
966 976
        if(st->index_entries[0].pos > last_start)
967 977
            last_start= st->index_entries[0].pos;
968 978
        if(st->index_entries[n-1].pos < first_end)
969 979
            first_end= st->index_entries[n-1].pos;
970 980
    }
981
    url_fseek(s->pb, oldpos, SEEK_SET);
971 982
    return last_start > first_end;
972 983
}
973 984

  

Also available in: Unified diff