Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Nasty bug in StillPicture()



On Saturday 18 October 2003 17:48, Thomas Heiligenmann wrote:
> Oliver Endriss schrieb:
> > On Saturday 18 October 2003 14:57, Thomas Heiligenmann wrote:
> > 
> >>Oops - just seen it. Here comes the updated patch :-)
> > 
> > 
> > I suggest to stop scanning immediately if we encounter an error.
> > For example (MPEG-2 case):
> > 
> >               if ((Data[i + 6] & 0xC0) == 0x80) {
> >                  // MPEG-2 PES header
> >                  if (i + 8 >= Length)
> >                     break;
> >                  offs += 3;
> >                  offs += Data[i + 8];
> >                  len -= 3;
> >                  len -= Data[i + 8];
> >                  if (len < 0 || offs + len >= Length)
> >                     break;
> >                  }
> >               else {
> >                  // MPEG-1 PES header
> >                  ...
> 
> Wouldn't it be better then to "return" immediately? After "break"-ing 
> the "while" loop a part of the (erratic) stream would be sent to the 
> driver anyway.
> 
> if (len < 0 || offs + len >= Length) {
>    free(buf);
>    return;
>    }
> ...

IIRC, these extensions are only included in the first PES header of a
picture. If we use 'return' we enforce that data must be passed
correctly. We don't accept garbled data in the buffer. (If the first
extension header is garbled there is no difference.)

If we use 'break' we are a little bit more liberal in what we accept.
Maybe the decoder can do something useful with the data processed so far.
IMHO, displaying a partial picture might be better that doing nothing.

Oliver


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index