This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 46d13a83853b71739300cdce1d514f9be7d05a59 Author: Michael Niedermayer <[email protected]> AuthorDate: Sun Nov 8 17:17:19 2026 +0100 Commit: michaelni <[email protected]> CommitDate: Thu Nov 12 13:55:55 2026 +0000 avcodec/pcm-dvdenc: pad the last frame to a whole block The FATE test encodes 85 samples with and without a fixed frame size. Fixes: up to 3 samples dropped at the end of a 24 bit stream Testcase: ffmpeg -f lavfi -i "sine=r=48000,atrim=end_sample=85" -c:a pcm_dvd -sample_fmt s32 -f framecrc - --- libavcodec/pcm-dvdenc.c | 5 +++-- tests/fate/pcm.mak | 8 ++++++++ tests/ref/fate/audio-enc-pcm-dvd-short-tail | 1 + tests/ref/fate/pcm-dvd-last-block | 12 ++++++++++++ tests/ref/fate/pcm-dvd-last-block-coarse-tb | 6 ++++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c index dc5224cc24..9d4d0c9e98 100644 --- a/libavcodec/pcm-dvdenc.c +++ b/libavcodec/pcm-dvdenc.c @@ -25,6 +25,7 @@ #include "bytestream.h" #include "codec_internal.h" #include "encode.h" +#include "internal.h" typedef struct PCMDVDContext { uint8_t header[3]; // Header added to every frame @@ -107,6 +108,7 @@ static av_cold int pcm_dvd_encode_init(AVCodecContext *avctx) s->header[2] = 0x80; avctx->frame_size = frame_size; + avctx->internal->pad_samples = s->samples_per_block; return 0; } @@ -179,8 +181,7 @@ const FFCodec ff_pcm_dvd_encoder = { CODEC_LONG_NAME("PCM signed 16|20|24-bit big-endian for DVD-Video media"), .p.type = AVMEDIA_TYPE_AUDIO, .p.id = AV_CODEC_ID_PCM_DVD, - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SMALL_LAST_FRAME | - AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, .priv_data_size = sizeof(PCMDVDContext), .init = pcm_dvd_encode_init, FF_CODEC_ENCODE_CB(pcm_dvd_encode_frame), diff --git a/tests/fate/pcm.mak b/tests/fate/pcm.mak index 6046244491..f06004ea29 100644 --- a/tests/fate/pcm.mak +++ b/tests/fate/pcm.mak @@ -62,6 +62,14 @@ FATE_PCM-$(call TRANSCODE, PCM_DVD, MPEG2VOB MPEGPS, WAV_DEMUXER PCM_S16LE_DECOD fate-pcm_dvd-16-1-96000: tests/data/asynth-96000-1.wav fate-pcm_dvd-16-1-96000: CMD = transcode wav $(TARGET_PATH)/tests/data/asynth-96000-1.wav vob "-c:a pcm_dvd" "-t 0.2" +FATE_PCM-$(call ALLYES, PCM_DVD_ENCODER LAVFI_INDEV SINE_FILTER ATRIM_FILTER ARESAMPLE_FILTER \ + PCM_S16$(if $(filter yes,$(HAVE_BIGENDIAN)),BE,LE)_DECODER FRAMECRC_MUXER PIPE_PROTOCOL) += fate-pcm-dvd-last-block +fate-pcm-dvd-last-block: CMD = framecrc -auto_conversion_filters -f lavfi -i "sine=r=48000,atrim=end_sample=85" -c:a pcm_dvd -sample_fmt s32 -map 0:a -map 0:a -flags2:a:1 +fixed_frame_size + +FATE_PCM-$(call ALLYES, PCM_DVD_ENCODER LAVFI_INDEV SINE_FILTER ATRIM_FILTER ARESAMPLE_FILTER \ + PCM_S16$(if $(filter yes,$(HAVE_BIGENDIAN)),BE,LE)_DECODER FRAMECRC_MUXER PIPE_PROTOCOL) += fate-pcm-dvd-last-block-coarse-tb +fate-pcm-dvd-last-block-coarse-tb: CMD = framecrc -auto_conversion_filters -f lavfi -i "sine=r=48000,atrim=end_sample=69" -c:a pcm_dvd -sample_fmt s32 -enc_time_base 1/1000 + # PCM Blu-ray encoder/decoder roundtrip tests (s16, locally generated sources) FATE_PCM_BLURAY_S16 = fate-pcm-bluray-s16-mono \ fate-pcm-bluray-s16-stereo \ diff --git a/tests/ref/fate/audio-enc-pcm-dvd-short-tail b/tests/ref/fate/audio-enc-pcm-dvd-short-tail index c91c63430d..6eaef1ef30 100644 --- a/tests/ref/fate/audio-enc-pcm-dvd-short-tail +++ b/tests/ref/fate/audio-enc-pcm-dvd-short-tail @@ -4,3 +4,4 @@ #sample_rate 0: 48000 #channel_layout_name 0: mono 0, 0, 0, 168, 507, 0x9073936f +0, 168, 168, 3, 15, 0x2c84046b, S=1, Skip Samples, 10, 0x00060001 diff --git a/tests/ref/fate/pcm-dvd-last-block b/tests/ref/fate/pcm-dvd-last-block new file mode 100644 index 0000000000..92d75383a7 --- /dev/null +++ b/tests/ref/fate/pcm-dvd-last-block @@ -0,0 +1,12 @@ +#tb 0: 1/48000 +#media_type 0: audio +#codec_id 0: pcm_dvd +#sample_rate 0: 48000 +#channel_layout_name 0: mono +#tb 1: 1/48000 +#media_type 1: audio +#codec_id 1: pcm_dvd +#sample_rate 1: 48000 +#channel_layout_name 1: mono +0, 0, 0, 85, 267, 0x7f3a49be, S=1, Skip Samples, 10, 0x00120003 +1, 0, 0, 85, 507, 0xa56549be, S=1, Skip Samples, 10, 0x01f20053 diff --git a/tests/ref/fate/pcm-dvd-last-block-coarse-tb b/tests/ref/fate/pcm-dvd-last-block-coarse-tb new file mode 100644 index 0000000000..798d84fb4a --- /dev/null +++ b/tests/ref/fate/pcm-dvd-last-block-coarse-tb @@ -0,0 +1,6 @@ +#tb 0: 1/1000 +#media_type 0: audio +#codec_id 0: pcm_dvd +#sample_rate 0: 48000 +#channel_layout_name 0: mono +0, 0, 0, 1, 219, 0x99c43631, S=1, Skip Samples, 10, 0x00120003 -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
