aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2024-06-01 18:41:15 -0400
committerJoshua M. Boniface <joshua@boniface.me>2024-06-01 18:41:15 -0400
commitc7f87c0d69701480de0f53c0fa5858cbb38de119 (patch)
tree79afa9dd828ce21f965257e26e03626f22c47ed2 /src
parent4fa3c30df2b64a14f8299dbf06043bc54df22a7d (diff)
Backport pull request #11910 from jellyfin/release-10.9.z
Audio normalization: parse ffmpeg output line by line Original-merge: d2be2ee480a44d3ed266d4632c3f38439b0dfaf5 Merged-by: joshuaboniface <joshua@boniface.me> Backported-by: Joshua M. Boniface <joshua@boniface.me>
Diffstat (limited to 'src')
-rw-r--r--src/Jellyfin.Extensions/StreamExtensions.cs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Jellyfin.Extensions/StreamExtensions.cs b/src/Jellyfin.Extensions/StreamExtensions.cs
index 182996852..0cfac384e 100644
--- a/src/Jellyfin.Extensions/StreamExtensions.cs
+++ b/src/Jellyfin.Extensions/StreamExtensions.cs
@@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
+using System.Threading;
namespace Jellyfin.Extensions
{
@@ -48,11 +50,12 @@ namespace Jellyfin.Extensions
/// Reads all lines in the <see cref="TextReader" />.
/// </summary>
/// <param name="reader">The <see cref="TextReader" /> to read from.</param>
+ /// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>All lines in the stream.</returns>
- public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader)
+ public static async IAsyncEnumerable<string> ReadAllLinesAsync(this TextReader reader, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
string? line;
- while ((line = await reader.ReadLineAsync().ConfigureAwait(false)) is not null)
+ while ((line = await reader.ReadLineAsync(cancellationToken).ConfigureAwait(false)) is not null)
{
yield return line;
}