Changes between Initial Version and Version 1 of Ticket #7572, comment 1


Ignore:
Timestamp:
Nov 28, 2018, 3:24:46 PM (9 months ago)
Author:
javer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7572, comment 1

    initial v1  
    2929    frame #10: 0x000000010f2d3a4e ffmpeg_g`main(argc=15, argv=0x00007ffee094aac0) at ffmpeg.c:4866
    3030    frame #11: 0x00007fff619ba08d libdyld.dylib`start + 1
     31(lldb) p a
     32(int) $0 = 0
     33(lldb) p b
     34(int) $1 = 2
     35(lldb) p m
     36(int) $4 = 1
     37(lldb) p frag_time
     38(int64_t) $5 = -9223372036854775808
     39(lldb) p *frag_index
     40(MOVFragmentIndex) $7 = {
     41  allocated_size = 66
     42  complete = 1
     43  current = 0
     44  nb_items = 2
     45  item = 0x00007fd65f100110
     46}
     47(lldb) p *frag_index->item
     48(MOVFragmentIndexItem) $8 = {
     49  moof_offset = 1412
     50  headers_read = 1
     51  current = 1
     52  nb_stream_info = 2
     53  stream_info = 0x00007fd65f100160
     54}
     55(lldb) p *frag_index->item->stream_info
     56(MOVFragmentStreamInfo) $9 = {
     57  id = 1
     58  sidx_pts = 2048
     59  first_tfra_pts = -9223372036854775808
     60  tfdt_dts = 0
     61  index_entry = 0
     62  encryption_index = 0x0000000000000000
     63}
    3164}}}
     65
     66According to the above information, we have infinite loop inside while cycle, because if frag_time == AV_NOPTS_VALUE nothing is changed inside cycle and we go to another loop, see libavformat/mov.c for details:
     67{{{#!cpp
     68static int search_frag_timestamp(MOVFragmentIndex *frag_index,
     69                                 AVStream *st, int64_t timestamp)
     70{
     71    int a, b, m;
     72    int64_t frag_time;
     73    int id = -1;
     74
     75    if (st) {
     76        // If the stream is referenced by any sidx, limit the search
     77        // to fragments that referenced this stream in the sidx
     78        MOVStreamContext *sc = st->priv_data;
     79        if (sc->has_sidx)
     80            id = st->id;
     81    }
     82
     83    a = -1;
     84    b = frag_index->nb_items;
     85
     86    while (b - a > 1) {
     87        m = (a + b) >> 1;
     88        frag_time = get_frag_time(frag_index, m, id);
     89        if (frag_time != AV_NOPTS_VALUE) {
     90            if (frag_time >= timestamp)
     91                b = m;
     92            if (frag_time <= timestamp)
     93                a = m;
     94        }
     95    }
     96    return a;
     97}
     98}}}