• Marton Balint's avatar
    avformat/mpegts: use get_packet_size in mpegts_resync for determining raw_packet_size · 6ec009f7
    Marton Balint authored
    The old resync logic had some bugs, for example the packet size could stuck
    into 192 bytes, because pos47_full was not updated for every packet, and for
    unseekable inputs the resync logic simply skipped some 0x47 sync bytes,
    therefore the calculated distance between sync bytes was a multiple of 188
    bytes.
    
    AVIO only buffers a single packet (for UDP/mpegts, that usually means 1316
    bytes), so for every ten consecutive 188-byte MPEGTS packets there was always a
    seek failure, and that caused the old code to not find the 188 byte pattern
    across 10 consecutive packets.
    
    This patch changes the custom logic to the one which is used when probing to
    determine the packet size. This was already proposed as a FIXME a long time
    ago...
    6ec009f7
mpegts.c 114 KB