mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-11-02 10:37:20 -05:00
Fix LUFS detection deadlock on albums with verbose output
This commit is contained in:
parent
eb0d05cf1e
commit
51e20a14c2
@ -261,14 +261,23 @@ public partial class AudioNormalizationTask : IScheduledTask
|
|||||||
|
|
||||||
using var reader = process.StandardError;
|
using var reader = process.StandardError;
|
||||||
float? lufs = null;
|
float? lufs = null;
|
||||||
|
var foundLufs = false;
|
||||||
await foreach (var line in reader.ReadAllLinesAsync(cancellationToken).ConfigureAwait(false))
|
await foreach (var line in reader.ReadAllLinesAsync(cancellationToken).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
Match match = LUFSRegex().Match(line);
|
if (foundLufs)
|
||||||
if (match.Success)
|
|
||||||
{
|
{
|
||||||
lufs = float.Parse(match.Groups[1].ValueSpan, CultureInfo.InvariantCulture.NumberFormat);
|
continue;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Match match = LUFSRegex().Match(line);
|
||||||
|
if (!match.Success)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
lufs = float.Parse(match.Groups[1].ValueSpan, CultureInfo.InvariantCulture.NumberFormat);
|
||||||
|
foundLufs = true;
|
||||||
|
// Don't break - keep draining stderr to prevent buffer deadlock
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lufs is null)
|
if (lufs is null)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user