[FFmpeg-devel] [PATCH] fix ts Continuity Count

Måns Rullgård mans
Fri Aug 31 23:07:07 CEST 2007


Jindrich Makovicka <makovick at gmail.com> writes:

> On Fri, 31 Aug 2007 10:03:41 +0100 (BST)
> M?ns Rullg?rd <mans at mansr.com> wrote:
>> >> > @@ -60,8 +60,8 @@
>> >> >              b |= 0x40;
>> >> >          *q++ = b;
>> >> >          *q++ = s->pid;
>> >> > +        *q++ = 0x10 | s->cc;
>> >> >          s->cc = (s->cc + 1) & 0xf;
>> >> > -        *q++ = 0x10 | s->cc;
>> >> >          if (first)
>> >> >              *q++ = 0; /* 0 offset */
>> >> >          len1 = TS_PACKET_SIZE - (q - packet);
>> >>
>> >> Why is this needed?  It only shifts the continuity counter by one.
>> >
>> > It'll cause the first cc start from 1 always, vlc will give warning
>> > about it.
>> 
>> So fix VLC.
>
> Moreover, this change is wrong because the code will break if someone
> tries to insert some dummy packets without payload, i.e. no CC
> change. CC _must_ be incremented before being stored into the cc field,
> not after.

Indeed.

> A possible workaround would be using 0x0f as an initial CC value.

There's nothing to be worked around.  VLC is overly picky and needs to
be fixed.  That's all there is to it.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list