aboutsummaryrefslogtreecommitdiffstats
path: root/tests/api/api-dump-stream-meta-test.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-06-22 07:37:45 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-07-03 20:18:55 +0200
commit11d3af0d7fe5c0e235b4a560c063fee4c05980e1 (patch)
tree4e164c9995c1a2a3f742553f22ba49fa08811d40 /tests/api/api-dump-stream-meta-test.c
parente813e1e940d30b862487e42eb73fd4785c8922aa (diff)
downloadffmpeg-11d3af0d7fe5c0e235b4a560c063fee4c05980e1.tar.gz
avcodec/dfpwmenc: Correctly pad input
Before this patch, the DFPWM1a encoder was marked as supporting variable frame sizes. The DFPWM1a format converts eight bytes of input into one output byte and so it simply padded the number of data output by frame->nb_samples * frame->ch_layout.nb_channels / 8 + (frame->nb_samples % 8 > 0 ? 1 : 0) This has several bugs: a) The additional byte leads to eight additional input byte being read; this can read into the frame's padding, i.e. the data can be uninitialized. b) The criterion for whether one should pad is wrong: nb_samples * nb_channels should be tested for divisibility by eight. c) The created frames can be undecodable (at least with our decoder): Our decoder requires the number of bits per frame to divisible by the number of channels, yet the above approach does not guarantee this. d) The padding will be added in the middle of the stream (potentially for every packet). This commit fixes all of this by removing the variable frame size cap and using AVCodecInternal.pad_samples to pad the last frame so that nb_samples * nb_channels is always a multiple of eight. The lavf-dfpwm FATE-test was affected by a). The frames originated from lavfi and were part of an audio frame pool, so that the padding contained data from an earlier (bigger) frame. Now the last frame is properly filled with silence. Reported-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'tests/api/api-dump-stream-meta-test.c')
0 files changed, 0 insertions, 0 deletions