aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMark Thompson <mrt@jkqxz.net>2016-03-17 13:41:02 +0000
committerMichael Niedermayer <michael@niedermayer.cc>2016-04-27 04:40:11 +0200
commit5c289c932fe46e173d2fb4fa034ea70dc32c8df0 (patch)
treeac19ff2a30aa849aed9de0a4d847d6ec5b9b3dc6 /libavcodec
parente8b1ce8d1b52025888e28f9715c055685ec939b1 (diff)
downloadffmpeg-5c289c932fe46e173d2fb4fa034ea70dc32c8df0.tar.gz
lavc/hevc: Allow arbitrary garbage in bytestream as long as at least one NAL unit is found.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit fbec157ea08f61063847bbe0dba28525e6283ff5) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/hevc_parse.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/hevc_parse.c b/libavcodec/hevc_parse.c
index 63ed84a8de..d557cc7f04 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;
+ }
}
}