summaryrefslogtreecommitdiff
path: root/libavcodec/hevc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-07-12 22:45:58 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-12 22:46:06 +0200
commit760304e4c3184d65cf90a017ea75ed40c3b823ea (patch)
tree0f20471f7ededbc04e93f6a85aae74741d540c9c /libavcodec/hevc.c
parentd5fcca83b915df9536d595a1a44c24294b606836 (diff)
parentd7bebe4805193783f0b6f292f9127a75709fb7d9 (diff)
Merge commit 'd7bebe4805193783f0b6f292f9127a75709fb7d9'
* commit 'd7bebe4805193783f0b6f292f9127a75709fb7d9': hevc: skip invalid/ignored NALUs when splitting the packet Merged-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r--libavcodec/hevc.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index a4b0fdd167..0f0846efa0 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2647,13 +2647,7 @@ static int decode_nal_unit(HEVCContext *s, const HEVCNAL *nal)
if (ret < 0)
return ret;
- ret = hls_nal_unit(s);
- if (ret < 0) {
- av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
- s->nal_unit_type);
- goto fail;
- } else if (!ret)
- return 0;
+ hls_nal_unit(s);
switch (s->nal_unit_type) {
case NAL_VPS:
@@ -2882,12 +2876,22 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length)
ret = init_get_bits8(&s->HEVClc->gb, nal->data, nal->size);
if (ret < 0)
goto fail;
- hls_nal_unit(s);
+
+ ret = hls_nal_unit(s);
+ if (ret <= 0) {
+ if (ret < 0) {
+ av_log(s->avctx, AV_LOG_ERROR, "Invalid NAL unit %d, skipping.\n",
+ s->nal_unit_type);
+ }
+ s->nb_nals--;
+ goto skip_nal;
+ }
if (s->nal_unit_type == NAL_EOB_NUT ||
s->nal_unit_type == NAL_EOS_NUT)
s->eos = 1;
+skip_nal:
buf += consumed;
length -= consumed;
}