From ecdeb02dda6dbb94c1c3b01b8406203eda225f9f Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Sun, 27 Sep 2026 19:48:51 -0400 Subject: [PATCH] FS#14005 - Use a 44.1KHz floor when guessing playback frequency Regression introduced in f87ff3a9b, which made it possible for audio playback to request a freq under 44.1KHz, instead of treating 44.1 as a floor (and upsampling) However, there is a report of 22KHz files playing back distorted on an imx233 target. IMO a 44KHz floor is reasonable, but this bug is a symptom of something deeper. Perhaps the mp3 codec isn't doing the right thing, or there's an issue in the pcm mixer somewhere, or the imx233 codec doesn't properly handle 22KHz? Further investigation is warranted. Change-Id: I751ce05f8605de7f90d3eb7b3c98873487df438b --- apps/playback.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/playback.c b/apps/playback.c index abb50345f7..d69b28cd2c 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -1258,7 +1258,7 @@ void allocate_playback_log(void) playback_log_handle = core_alloc(PLAYBACK_LOG_BUFSZ); if (playback_log_handle > 0) { - DEBUGF("%s Allocated %d bytes\n", __func__, PLAYBACK_LOG_BUFSZ); + DEBUGF("%s Allocated %d bytes\n", __func__, PLAYBACK_LOG_BUFSZ); char *buf = core_get_data(playback_log_handle); buf[0] = '\0'; } @@ -2995,7 +2995,7 @@ static void audio_on_track_changed(void) static void audio_start_playback(const struct audio_resume_info *resume_info, unsigned int flags) { -/* +/* * Refuse to start playback if usb audio is active. See gui_wps_show() for * a splash message to the user. * NOTE: if USBAudio ever gets its own DSP channel, this block can go away! @@ -4270,7 +4270,8 @@ static unsigned long audio_guess_frequency(struct mp3entry *id3) have_44 = true; if (caps->samprs[i] == SAMPR_48) have_48 = true; - if (id3->frequency == caps->samprs[i]) + /* Always upscale to 44.1 or better */ + if (id3->frequency >= SAMPR_44 && id3->frequency == caps->samprs[i]) return id3->frequency; } unsigned long fallback = (id3->frequency % 4000) ? SAMPR_44 : SAMPR_48;