[FFmpeg-cvslog] hevc: skip invalid/ignored NALUs when splitting the packet
Anton Khirnov
git at videolan.org
Sun Jul 12 22:53:40 CEST 2015
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jul 9 18:01:08 2015 +0200| [d7bebe4805193783f0b6f292f9127a75709fb7d9] | committer: Anton Khirnov
hevc: skip invalid/ignored NALUs when splitting the packet
There is no need to wait until actually decoding the NALU. This will
allow to get rid of the second hls_nal_unit() call later.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d7bebe4805193783f0b6f292f9127a75709fb7d9
---
libavcodec/hevc.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 9b1cd66..7080d00 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2503,13 +2503,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:
@@ -2709,12 +2703,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;
}
More information about the ffmpeg-cvslog
mailing list