]> git.sesse.net Git - ffmpeg/commitdiff
hevc: make avcodec_decode_video2() fail if get_format() fails
authorwm4 <nfxjfg@googlemail.com>
Thu, 14 May 2015 17:23:57 +0000 (19:23 +0200)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Tue, 19 May 2015 17:59:06 +0000 (18:59 +0100)
Personally, I need the decoder to back out if get_format() returns no
usable pixel format. This didn't work because the error code was not
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.

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/hevc.c

index 4c06fb8d620ab5ff886ddef0939178e6e5495a58..1b5e2edeb5ce71de6489eaa472807c5a77fe25e7 100644 (file)
@@ -2818,7 +2818,7 @@ 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 = decode_nal_unit(s, &s->nals[i]);
+        ret = decode_nal_unit(s, &s->nals[i]);
         if (ret < 0) {
             av_log(s->avctx, AV_LOG_WARNING,
                    "Error parsing NAL unit #%d.\n", i);