diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-04 14:17:33 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-02-08 06:10:08 +0100 |
commit | 115ac90ec99af35838f65fc5b8f1b27e2ca4ab37 (patch) | |
tree | 7ab4c4d1a598fdb60af38a67bda538b84d289a8b /libavcodec/adts_header.h | |
parent | 66d7a211329e79ad61316f67726e89d07c21d862 (diff) | |
download | ffmpeg-115ac90ec99af35838f65fc5b8f1b27e2ca4ab37.tar.gz |
avcodec/cbs_mpeg2: Simplify splitting fragment
avpriv_find_start_code() supports non-contiguous buffers
by maintaining a state that allows to find start codes
that span across multiple buffers; a consequence thereof
is that avpriv_find_start_code() is given a zero-sized
buffer, it does not modify this state, so that it appears
as if a start code was found if the state contained a start code.
This can e.g. happen with Sequence End units in MPEG-2 and
to counter this, cbs_mpeg2_split_fragment() reset the state
when it has already encountered the end of the fragment
in order to add the last unit (if it is only of the form 00 00 01 xy)
only once; it also used a flag to set whether this is the final unit.
Yet this can be improved by simply resetting state unconditionally
(thereby avoiding a branch); the flag can be removed by just checking
whether we have a valid start code (of the next unit to add)
at the end.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/adts_header.h')
0 files changed, 0 insertions, 0 deletions