This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit b799c7772b49961cbd3eb1975ffdb636ad69e15c Author: marcos ashton <[email protected]> AuthorDate: Sat Apr 18 13:17:07 2026 +0100 Commit: michaelni <[email protected]> CommitDate: Thu Aug 27 10:54:38 2026 +0000 tests/fate/libavutil: add FATE test for downmix_info Test av_downmix_info_update_side_data() including first-call allocation with zero-initialized defaults, field write/read-back, second-call reuse (same pointer, preserved values), and the OOM path via av_max_alloc. Coverage for libavutil/downmix_info.c: 100.00% -> 100.00% On a full FATE run the file is already covered by the AC-3 decoder tests (fate-ac3-4.0 and friends), which require FATE_SAMPLES. This test exercises the API directly and keeps the file covered on builds that run without samples. Signed-off-by: marcos ashton <[email protected]> --- .forgejo/CODEOWNERS | 2 + libavutil/Makefile | 1 + libavutil/tests/.gitignore | 1 + libavutil/tests/downmix_info.c | 89 ++++++++++++++++++++++++++++++++++++++++++ tests/fate/libavutil.mak | 4 ++ tests/ref/fate/downmix_info | 8 ++++ 6 files changed, 105 insertions(+) diff --git a/.forgejo/CODEOWNERS b/.forgejo/CODEOWNERS index 45cdb55297..82c9707553 100644 --- a/.forgejo/CODEOWNERS +++ b/.forgejo/CODEOWNERS @@ -237,6 +237,7 @@ libavutil/tests/ambient_viewing_environment.* @MarcosAsh libavutil/tests/buffer.* @MarcosAsh libavutil/tests/csp.* @MarcosAsh libavutil/tests/dovi_meta.* @MarcosAsh +libavutil/tests/downmix_info.* @MarcosAsh libavutil/tests/hdr_dynamic_vivid_metadata.* @MarcosAsh libavutil/tests/mastering_display_metadata.* @MarcosAsh libavutil/tests/pixdesc.* @MarcosAsh @@ -248,6 +249,7 @@ tests/ref/fate/ambient_viewing_environment @MarcosAsh tests/ref/fate/buffer @MarcosAsh tests/ref/fate/csp @MarcosAsh tests/ref/fate/dovi_meta @MarcosAsh +tests/ref/fate/downmix_info @MarcosAsh tests/ref/fate/hdr_dynamic_vivid_metadata @MarcosAsh tests/ref/fate/mastering_display_metadata @MarcosAsh tests/ref/fate/pixdesc @MarcosAsh diff --git a/libavutil/Makefile b/libavutil/Makefile index 9cb3108b38..fb93ed0cf5 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -277,6 +277,7 @@ TESTPROGS = adler32 \ dict \ display \ dovi_meta \ + downmix_info \ encryption_info \ error \ eval \ diff --git a/libavutil/tests/.gitignore b/libavutil/tests/.gitignore index 0f43921ed6..6fa7268abf 100644 --- a/libavutil/tests/.gitignore +++ b/libavutil/tests/.gitignore @@ -22,6 +22,7 @@ /dict /display /dovi_meta +/downmix_info /error /encryption_info /eval diff --git a/libavutil/tests/downmix_info.c b/libavutil/tests/downmix_info.c new file mode 100644 index 0000000000..cdc25d6d17 --- /dev/null +++ b/libavutil/tests/downmix_info.c @@ -0,0 +1,89 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <limits.h> +#include <stdio.h> + +#include "libavutil/downmix_info.h" +#include "libavutil/frame.h" +#include "libavutil/mem.h" + +int main(void) +{ + AVFrame *frame; + AVDownmixInfo *info, *info2; + + /* First call: allocates side data, zero-initialized. */ + printf("Testing av_downmix_info_update_side_data()\n"); + frame = av_frame_alloc(); + if (!frame) + return 1; + + info = av_downmix_info_update_side_data(frame); + if (info) { + printf("create: OK\n"); + printf("defaults: type=%d center=%.3f center_ltrt=%.3f surround=%.3f" + " surround_ltrt=%.3f lfe=%.3f\n", + info->preferred_downmix_type, + info->center_mix_level, info->center_mix_level_ltrt, + info->surround_mix_level, info->surround_mix_level_ltrt, + info->lfe_mix_level); + + /* Write fields and read them back. The mix levels are absolute scale + * factors, not gains in dB, so every value is a distinct nonnegative + * factor. Each one is a negative power of two or a sum of two, which + * makes the decimal output exact on any platform. */ + info->preferred_downmix_type = AV_DOWNMIX_TYPE_LTRT; + info->center_mix_level = 0.5; + info->center_mix_level_ltrt = 0.625; + info->surround_mix_level = 0.25; + info->surround_mix_level_ltrt = 0.375; + info->lfe_mix_level = 0.125; + printf("write: type=%d center=%.3f center_ltrt=%.3f surround=%.3f" + " surround_ltrt=%.3f lfe=%.3f\n", + info->preferred_downmix_type, + info->center_mix_level, info->center_mix_level_ltrt, + info->surround_mix_level, info->surround_mix_level_ltrt, + info->lfe_mix_level); + } else { + printf("create: FAIL\n"); + } + + /* Second call must reuse the existing side data (same pointer, values kept). */ + info2 = av_downmix_info_update_side_data(frame); + if (info && info2) { + printf("reuse: same_pointer=%s preserved_type=%d preserved_center=%.3f\n", + info == info2 ? "yes" : "no", + info2->preferred_downmix_type, info2->center_mix_level); + } + + av_frame_free(&frame); + + /* OOM path: av_max_alloc(1) forces the internal side data allocation to fail. */ + printf("\nTesting OOM path\n"); + frame = av_frame_alloc(); + if (frame) { + av_max_alloc(1); + info = av_downmix_info_update_side_data(frame); + printf("OOM: %s\n", info ? "FAIL" : "OK"); + av_max_alloc(INT_MAX); + av_frame_free(&frame); + } + + return 0; +} diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak index 6be9b1008d..0bc152dc49 100644 --- a/tests/fate/libavutil.mak +++ b/tests/fate/libavutil.mak @@ -94,6 +94,10 @@ FATE_LIBAVUTIL += fate-dovi_meta fate-dovi_meta: libavutil/tests/dovi_meta$(EXESUF) fate-dovi_meta: CMD = run libavutil/tests/dovi_meta$(EXESUF) +FATE_LIBAVUTIL += fate-downmix_info +fate-downmix_info: libavutil/tests/downmix_info$(EXESUF) +fate-downmix_info: CMD = run libavutil/tests/downmix_info$(EXESUF) + FATE_LIBAVUTIL += fate-encryption-info fate-encryption-info: libavutil/tests/encryption_info$(EXESUF) fate-encryption-info: CMD = run libavutil/tests/encryption_info$(EXESUF) diff --git a/tests/ref/fate/downmix_info b/tests/ref/fate/downmix_info new file mode 100644 index 0000000000..b75e98029c --- /dev/null +++ b/tests/ref/fate/downmix_info @@ -0,0 +1,8 @@ +Testing av_downmix_info_update_side_data() +create: OK +defaults: type=0 center=0.000 center_ltrt=0.000 surround=0.000 surround_ltrt=0.000 lfe=0.000 +write: type=2 center=0.500 center_ltrt=0.625 surround=0.250 surround_ltrt=0.375 lfe=0.125 +reuse: same_pointer=yes preserved_type=2 preserved_center=0.500 + +Testing OOM path +OOM: OK -- 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]
