]> git.sesse.net Git - ffmpeg/commit
avformat/mpegts: use get_packet_size in mpegts_resync for determining raw_packet_size
authorMarton Balint <cus@passwd.hu>
Wed, 20 May 2020 19:44:39 +0000 (21:44 +0200)
committerMarton Balint <cus@passwd.hu>
Wed, 27 May 2020 20:36:53 +0000 (22:36 +0200)
commit6ec009f7e22d69502db83df49383b4a7c814ed7d
tree3a315785b9417c9ca0d4001d3c2e88d717ca9789
parent09e6e455885c929b492e96e6e71cbc7d94d2ab1c
avformat/mpegts: use get_packet_size in mpegts_resync for determining raw_packet_size

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...
libavformat/mpegts.c