mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/14960
Author: @karm235
Created: 10/7/2025
Status: ✅ Merged
Merged: 10/12/2025
Merged by: @joshuaboniface
Base:
master← Head:13697-fix-lufs-detection📝 Commits (2)
51e20a1Fix LUFS detection deadlock on albums with verbose output6097045cleanup📊 Changes
1 file changed (+11 additions, -3 deletions)
View changed files
📝
Emby.Server.Implementations/ScheduledTasks/Tasks/AudioNormalizationTask.cs(+11 -3)📄 Description
The current implementation of the Audio Normalization task has a deadlock issue when scanning albums containing tracks with non-uniform sample rates (e.g., an album where most tracks are 48kHz but one is 96kHz). The task hangs during album LUFS calculation because ffmpeg generates verbose output about sample rate conversions, but the code stops reading stderr after finding the LUFS value.
Root Cause
When processing albums with mismatched sample rates, ffmpeg outputs additional warnings/messages to stderr while resampling. The original code used break to exit the loop immediately after finding the LUFS value, which stopped reading from stderr. This causes ffmpeg's stderr buffer to fill up, and ffmpeg blocks waiting for the buffer to drain, resulting in a deadlock.
Changes
Replaced the break statement in CalculateLUFSAsync with a foundLufs flag that allows the loop to continue reading and draining ffmpeg's stderr stream after the LUFS value is found. This prevents the deadlock by ensuring the stderr buffer never fills up,regardless of how verbose ffmpeg's output is.
Issues
Fixes #13697
Remarks
In my testing of this issue I never got the "Failed to find LUFS value in output" error; it simply hung. This should fix that issue based on the original description of the issue, though.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.