1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/cbs: Avoid branch

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-05-05 18:22:37 +02:00
parent f71d0f0559
commit 0d7172a9ff

View File

@ -783,15 +783,13 @@ static int cbs_insert_unit(CodedBitstreamFragment *frag,
if (position < frag->nb_units)
memcpy(units + position + 1, frag->units + position,
(frag->nb_units - position) * sizeof(*units));
}
memset(units + position, 0, sizeof(*units));
if (units != frag->units) {
av_free(frag->units);
frag->units = units;
}
memset(units + position, 0, sizeof(*units));
++frag->nb_units;
return 0;