[FFmpeg-devel] [PATCH 2/2] avformat/mpegts: Skip over broken 0x80 headers

Ronald S. Bultje rsbultje at gmail.com
Sun Apr 24 03:09:37 CEST 2016


Hi,

On Sun, Apr 10, 2016 at 11:12 AM, Michael Niedermayer <
michael at niedermayer.cc> wrote:

> @@ -2344,6 +2344,12 @@ static int mpegts_resync(AVFormatContext *s, int
> seekback)
>
>      avio_seek(pb, -FFMIN(seekback, pos), SEEK_CUR);
>
> +    //Special case for files like 01c56b0dc1.ts
> +    if (current_packet[0] == 0x80 && current_packet[12] == 0x47) {
> +        avio_seek(pb, 12, SEEK_CUR);
> +        return 0;
> +    }
> +
>      for (i = 0; i < ts->resync_size; i++) {
>          c = avio_r8(pb);
>          if (avio_feof(pb))


This comment doesn't explain why this is OK. What is 0x47? What is 0x80?
Why 0 and 12? Why is 01.ts broken and why does this fix it?

This may be really cleverly designed, but right now (b/c of the useless
comment), it looks like a custom hack that nobody will ever understand. If
Michael is hit by a bus, this code will thus be deleted. The file will
re-break, even with this comment.

Ronald


More information about the ffmpeg-devel mailing list