[FFmpeg-devel] [PATCH 10/18] cbs: Remove superfluous checks for ff_cbs_delete_unit
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Mon Jun 17 18:46:00 EEST 2019
James Almer:
> On 6/17/2019 12:42 AM, Andreas Rheinhardt wrote:
>> ff_cbs_delete_unit never fails if the index of the unit to delete is
>> valid; document this behaviour explicitly and remove the checks for
>> whether ff_cbs_delete_unit failed, because all the callers of
>> ff_cbs_delete_unit already make sure that the index is valid.
>
> Add a comment about why you're ignoring the return values in all three
> filters. If for whatever reason the filters are changed in the future
> and it can no longer be ensured the call will never fail, the developer
> should be aware of it.
>
Ok. I just noticed that the call for deleting AV1 temporal delimiters
doesn't check whether the fragment has a unit at all (in fact, the
check before that call already presupposes it). The only way for
ff_cbs_read_packet to return an empty fragment and no error is if the
packet's buf has a size of zero (this is legal according to the API if
the packet has side-data). What should be done about packets that
don't result in a single unit and more specifically about zero-sized
packets? The obvious answer would be to simply add a check to
av1_metadata like the already existing in h264_metadata; but
discarding side-data only packets is no good.
(If the zero-sized packet had new extradata as side-data, then that's
something that may be parsed and rewritten; the other side-data stuff
should simply be passed through.)
- Andreas
More information about the ffmpeg-devel
mailing list