On Thu, Aug 1, 2013 at 3:00 PM, Diego Biurrun <[email protected]> wrote:
> On Wed, Jul 31, 2013 at 09:46:47AM +0200, Vittorio Giovara wrote:
> > --- a/libavcodec/h264.c
> > +++ b/libavcodec/h264.c
> > @@ -4409,7 +4432,7 @@ static int decode_nal_units(H264Context *h, const
> uint8_t *buf, int buf_size,
> > ptr = ff_h264_decode_nal(hx, buf + buf_index, &dst_length,
> > &consumed, next_avc - buf_index);
> > if (ptr == NULL || dst_length < 0) {
> > - buf_index = -1;
> > + ret = -1;
> > goto end;
> > }
> > i = buf_index + consumed;
> > @@ -4480,7 +4504,7 @@ again:
> > if (h->nal_unit_type != NAL_IDR_SLICE) {
> > av_log(h->avctx, AV_LOG_ERROR,
> > "Invalid mix of idr and non-idr slices\n");
> > - buf_index = -1;
> > + ret = -1;
> > goto end;
> > }
> > idr(h); // FIXME ensure we don't lose some frames if
> there is reordering
> > @@ -4579,10 +4604,10 @@ again:
> > - if (h264_set_parameter_from_sps(h) < 0) {
> > - buf_index = -1;
> > + ret = h264_set_parameter_from_sps(h);
> > + if (ret < 0)
> > goto end;
> > - }
> > +
> > break;
> > case NAL_PPS:
> > init_get_bits(&h->gb, ptr, bit_length);
> > @@ -4631,7 +4656,7 @@ end:
> > h->picture_structure ==
> PICT_BOTTOM_FIELD);
> > }
> >
> > - return buf_index;
> > + return (ret < 0) ? ret : buf_index;
> > }
>
> This was simpler before when buf_index was returned.
>
Well, maybe so, but I found it confusing that you could use buf_index to
carry an error message, and using ret everywhere is more consistent with
the return handling of the rest of the file. May I leave this in?
Amended all other changes locally.
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel