Takashi Iwai
c349a7f6d8
- Backport upstream fixes: buffer overflow fixes in aplay, segfault in aplaymidi, etc: 0008-topology-include-locale.h.patch 0009-nhlt-dmic-info.c-include-sys-types.h.patch 0010-topology-pre-processor-Add-support-for-enum-controls.patch 0011-configure.ac-fix-UMP-support-detection.patch 0012-bat-really-skip-analysis-of-the-first-period-and-upd.patch 0013-topology-add-include-for-ENABLE_NLS-on-musl.patch 0014-nhlt-use-stdint.h-types.patch 0015-Revert-nhlt-dmic-info.c-include-sys-types.h.patch 0016-aplay-use-stdint.h-types-instead-u_int-u_short-u_cha.patch 0017-alsa-restore.rules-use-devnode-instead-number-atribu.patch 0018-nhlt-Revert-SSP_ANALOG-device_type-field.patch 0019-alsactl-fix-potential-buffer-overwrite.patch 0020-aplay-fix-buffer-overflow-and-tainted-format-string.patch 0021-misc-fix-incorrect-usages-of-strerror.patch 0022-aplay-Add-option-for-specifying-subformat.patch 0023-aplay-allow-to-compile-with-older-alsa-lib-subformat.patch 0024-aplay-log-pcm-status-before-reporting-a-fatal-error.patch 0025-aplay-enable-timestamps-by-default.patch 0026-aplay-status-dumps-are-called-only-in-verbose-mode.patch 0027-aplaymidi-Set-event-completely-for-tempo-event.patch OBS-URL: https://build.opensuse.org/request/show/1137523 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=210
45 lines
1.8 KiB
Diff
45 lines
1.8 KiB
Diff
From 039e4cad48a01437d195914b57b5da83ebc582c3 Mon Sep 17 00:00:00 2001
|
|
From: Delio Brignoli <dbrignoli@audioscience.com>
|
|
Date: Mon, 18 Sep 2023 09:33:37 +0100
|
|
Subject: [PATCH] bat: really skip analysis of the first period and update
|
|
related comment
|
|
|
|
Prior to this change bat/analyze.c would skip the last period of the recording, contrary to
|
|
what the comment in the code which stated the first period was meant to be skipped.
|
|
|
|
The comment has been updated to state that both the first and last period are skipped and the code
|
|
has been updated to match.
|
|
|
|
Closes: https://github.com/alsa-project/alsa-utils/pull/237
|
|
Signed-off-by: Delio Brignoli <dbrignoli@audioscience.com>
|
|
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
|
---
|
|
bat/analyze.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/bat/analyze.c b/bat/analyze.c
|
|
index 686788000f99..b8d02706fe66 100644
|
|
--- a/bat/analyze.c
|
|
+++ b/bat/analyze.c
|
|
@@ -299,7 +299,7 @@ static int calculate_noise(struct bat *bat, float *src, int channel)
|
|
/* each section has 2 sine periods, the first one for locating
|
|
* and the second one for noise calculating */
|
|
int nsamples_per_section = nsamples * 2;
|
|
- /* all sine periods will be calculated except the first one */
|
|
+ /* all sine periods will be calculated except the first and last one */
|
|
int nsection = bat->frames / nsamples - 1;
|
|
|
|
fprintf(bat->log, _("samples per period: %d\n"), nsamples);
|
|
@@ -331,7 +331,7 @@ static int calculate_noise(struct bat *bat, float *src, int channel)
|
|
/* calculate average noise level */
|
|
sum_snr_pc = 0.0;
|
|
cnt_clean = cnt_noise = 0;
|
|
- for (i = 0, offset = 0; i < nsection; i++) {
|
|
+ for (i = 1, offset = nsamples; i < nsection; i++) {
|
|
na.snr_db = SNR_DB_INVALID;
|
|
|
|
err = calculate_noise_one_period(bat, &na, src + offset,
|
|
--
|
|
2.35.3
|
|
|