aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-19 22:31:10 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-02-19 22:34:41 +0100
commitca9f7e1832785414362bb8aeef1c7eb0a454d92e (patch)
tree1e1e5c4342f192ec8b9fb6d47aa7604493bc1405
parentef08d554e0cf37fd92a1413dd2d32ce517fedbed (diff)
parent521726ff577ca80b399d1abb687e3e1fd4840e4a (diff)
downloadffmpeg-ca9f7e1832785414362bb8aeef1c7eb0a454d92e.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: hevc: Always consider VLC NALU type mismatch fatal Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/hevc.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index c253144118..2c7a6312d0 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2285,9 +2285,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
s->nal_unit_type);
- if (s->avctx->err_recognition & AV_EF_EXPLODE)
- return ret;
- return 0;
+ goto fail;
} else if (!ret)
return 0;
@@ -2295,23 +2293,23 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
case NAL_VPS:
ret = ff_hevc_decode_nal_vps(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_SPS:
ret = ff_hevc_decode_nal_sps(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_PPS:
ret = ff_hevc_decode_nal_pps(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_SEI_PREFIX:
case NAL_SEI_SUFFIX:
ret = ff_hevc_decode_nal_sei(s);
if (ret < 0)
- return ret;
+ goto fail;
break;
case NAL_TRAIL_R:
case NAL_TRAIL_N:
@@ -2357,7 +2355,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
return ret;
} else if (!s->ref) {
av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n");
- return AVERROR_INVALIDDATA;
+ goto fail;
}
if (s->nal_unit_type != s->first_nal_type) {
@@ -2373,8 +2371,7 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
if (ret < 0) {
av_log(s->avctx, AV_LOG_WARNING,
"Error constructing the reference lists for the current slice.\n");
- if (s->avctx->err_recognition & AV_EF_EXPLODE)
- return ret;
+ goto fail;
}
}
@@ -2390,8 +2387,10 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
restore_tqb_pixels(s);
}
- if (ctb_addr_ts < 0)
- return ctb_addr_ts;
+ if (ctb_addr_ts < 0) {
+ ret = ctb_addr_ts;
+ goto fail;
+ }
break;
case NAL_EOS_NUT:
case NAL_EOB_NUT:
@@ -2407,6 +2406,10 @@ static int decode_nal_unit(HEVCContext *s, const uint8_t *nal, int length)
}
return 0;
+fail:
+ if (s->avctx->err_recognition & AV_EF_EXPLODE)
+ return ret;
+ return 0;
}
/* FIXME: This is adapted from ff_h264_decode_nal, avoiding duplication
@@ -2619,8 +2622,7 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
if (ret < 0) {
av_log(s->avctx, AV_LOG_WARNING,
"Error parsing NAL unit #%d.\n", i);
- if (s->avctx->err_recognition & AV_EF_EXPLODE)
- goto fail;
+ goto fail;
}
}