[FFmpeg-devel] [PATCH] hevc: make avcodec_decode_video2() fail if get_format() fails

Michael Niedermayer michaelni at gmx.at
Thu May 14 19:09:06 CEST 2015


On Thu, May 14, 2015 at 06:49:34PM +0200, Andreas Cadhalpun wrote:
> On 14.05.2015 18:27, wm4 wrote:
> > Personally, I need to the decoder to back out if get_format() returns no
>                      ^
> This 'to' should not be there.
> 
> > useable pixel format. This didn't work because the error code was not
> 
> usable

chaneged


> 
> > propagated down the call chain. This in turn happened because the
> > variable declaration removed in this patch shadowed the variable, whose
> > value is returned at the end of the function. Consequently, failures of
> > decode_nal_unit() were ignored in this place.
> > ---
> >  libavcodec/hevc.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
> > index 459030c..199a3b9 100644
> > --- a/libavcodec/hevc.c
> > +++ b/libavcodec/hevc.c
> > @@ -3000,7 +3000,6 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
> >  
> >      /* parse the NAL units */
> >      for (i = 0; i < s->nb_nals; i++) {
> > -        int ret;
> >          s->skipped_bytes = s->skipped_bytes_nal[i];
> >          s->skipped_bytes_pos = s->skipped_bytes_pos_nal[i];
> >  
> 
> Looks good.

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150514/f1884a4e/attachment.asc>


More information about the ffmpeg-devel mailing list