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

Mark Thompson sw at jkqxz.net
Thu Mar 17 14:48:37 CET 2016


On 17/03/16 12:30, Hendrik Leppkes wrote:
> On Thu, Mar 17, 2016 at 1:21 PM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
>> 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?
>>
> 
> Something I forgot to mention, it would already skip random garbage in
> between NALs right now, and just error out when its at the end of a
> buffer. That seems inconsistent, if anything.

Ok, attached is another version which just allows any garbage you like at the
end of the packet as long as at least one NAL unit is found.

Still fixes <https://trac.ffmpeg.org/ticket/5344>.

Thanks,

- Mark

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavc-hevc-Allow-arbitrary-garbage-in-bytestream-as-l.patch
Type: text/x-diff
Size: 1275 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160317/e917b338/attachment.patch>


More information about the ffmpeg-devel mailing list