• Jeremy Vignelles's avatar
    demux: ts: fixed duration probing · 584b75bb
    Jeremy Vignelles authored
    Symptoms: I have a recorded .ts file that is around 15 seconds long for
    VLC can play the stream fine, but the displayed duration is 10s.
    When VLC reaches the end of the file, it seems to realize that there is
    more data and increases the duration as the file plays.
    Digging into ProbeEnd:
    I digged into the code and found the ProbeEnd method.
    It calls ProbeChunk, with output args (the pcr and a found boolean).
    If pcr == -1, the previous chunk is taken, until PROBE_MAX is reached.
    However, the i_pcr received from the ProbeChunk method is the pcr of the
    last packet, and not the pcr of the last packet with a pcr.
    It means that most of the time, the pcr is -1 and the previous chunk is
    read, even though b_found is true.
    What's the use of that condition? I removed it, please correct me if I'm
    The ProbeStart has the same suspicious condition, so I removed it too. I
    also saw the suspicious `i_pos > 0` which is always false at the first
    Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <fcvlcdev@free.fr>
ts.c 95.7 KB