[FFmpeg-cvslog] lavc/hevc: Allow arbitrary garbage in bytestream as long as at least one NAL unit is found.

Mark Thompson git at videolan.org
Sat Mar 26 22:36:07 CET 2016


ffmpeg | branch: release/3.0 | Mark Thompson <mrt at jkqxz.net> | Thu Mar 17 13:41:02 2016 +0000| [d6adcab84280f1cb35ad25e22c6acd5b01c50c08] | committer: Michael Niedermayer

lavc/hevc: Allow arbitrary garbage in bytestream as long as at least one NAL unit is found.

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit fbec157ea08f61063847bbe0dba28525e6283ff5)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d6adcab84280f1cb35ad25e22c6acd5b01c50c08
---

 libavcodec/hevc_parse.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c
index 63ed84a..d557cc7 100644
--- a/libavcodec/hevc_parse.c
+++ b/libavcodec/hevc_parse.c
@@ -232,8 +232,14 @@ int ff_hevc_split_packet(HEVCContext *s, HEVCPacket *pkt, const uint8_t *buf, in
                 ++buf;
                 --length;
                 if (length < 4) {
-                    av_log(avctx, AV_LOG_ERROR, "No start code is found.\n");
-                    return AVERROR_INVALIDDATA;
+                    if (pkt->nb_nals > 0) {
+                        // No more start codes: we discarded some irrelevant
+                        // bytes at the end of the packet.
+                        return 0;
+                    } else {
+                        av_log(avctx, AV_LOG_ERROR, "No start code is found.\n");
+                        return AVERROR_INVALIDDATA;
+                    }
                 }
             }
 



More information about the ffmpeg-cvslog mailing list