[FFmpeg-devel] [PATCH] lavc/hevc: Allow arbitrarily many trailing_zero_8bits after a NAL unit in bytestream format.

Hendrik Leppkes h.leppkes at gmail.com
Thu Mar 17 13:21:56 CET 2016


On Thu, Mar 17, 2016 at 1:10 PM, Mark Thompson <sw at jkqxz.net> wrote:
>>
>> Wouldn't it be simpler then to add a condition to the existing loop to
>> only error out when no NALs exist?
>
> I apologise if I'm not understanding exactly what you mean, but wouldn't that
> then accept any trailing garbage at all as long as there is one valid NAL unit?

Yes, it would. From what I can tell, that just how h264 works as well,
and to share code, it could probably even be adjusted to use
avpriv_find_start_code, since the structure of the start codes is
exactly the same.
Decoders should generally be rather forgiving, and if we can decode
one or more NALs from a buffer, then we shouldn't discard all of that
work on account of a few random bytes, IMHO.

That said, how do these extra zeros even end up being left over? From
what I can tell, ff_hevc_extract_rbsp should consume all data from the
previous start code up to the next one?

- Hendrik


More information about the ffmpeg-devel mailing list