aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Helpers/HlsHelpers.cs
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2021-10-26 17:43:36 -0600
committerCody Robibero <cody@robibe.ro>2021-10-26 17:43:36 -0600
commitf78f1e834ce1907157d4d43cf8564cf40d05fb9f (patch)
treebeb4e348e4d338a8b459f8a421ba19409d478ba9 /Jellyfin.Api/Helpers/HlsHelpers.cs
parent2888567ea53c1c839b0cd69e0ec1168cf51f36a8 (diff)
parent39d5bdac96b17eb92bd304736cc2728832e1cad0 (diff)
Merge remote-tracking branch 'upstream/master' into client-logger
Diffstat (limited to 'Jellyfin.Api/Helpers/HlsHelpers.cs')
-rw-r--r--Jellyfin.Api/Helpers/HlsHelpers.cs11
1 files changed, 3 insertions, 8 deletions
diff --git a/Jellyfin.Api/Helpers/HlsHelpers.cs b/Jellyfin.Api/Helpers/HlsHelpers.cs
index 18e23fb5c..456762147 100644
--- a/Jellyfin.Api/Helpers/HlsHelpers.cs
+++ b/Jellyfin.Api/Helpers/HlsHelpers.cs
@@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.IO;
-using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Api.Models.StreamingDtos;
@@ -39,7 +38,7 @@ namespace Jellyfin.Api.Helpers
FileAccess.Read,
FileShare.ReadWrite,
IODefaults.FileStreamBufferSize,
- FileOptions.SequentialScan);
+ FileOptions.Asynchronous | FileOptions.SequentialScan);
await using (fileStream.ConfigureAwait(false))
{
using var reader = new StreamReader(fileStream);
@@ -99,8 +98,7 @@ namespace Jellyfin.Api.Helpers
return fmp4InitFileName;
}
- var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
- if (isWindows)
+ if (OperatingSystem.IsWindows())
{
// on Windows
// #EXT-X-MAP:URI="X:\transcodes\prefix-1.mp4"
@@ -118,10 +116,7 @@ namespace Jellyfin.Api.Helpers
/// <returns>The playlist text as a string.</returns>
public static string GetLivePlaylistText(string path, StreamState state)
{
- using var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
- using var reader = new StreamReader(stream);
-
- var text = reader.ReadToEnd();
+ var text = File.ReadAllText(path);
var segmentFormat = EncodingHelper.GetSegmentFileExtension(state.Request.SegmentContainer).TrimStart('.');
if (string.Equals(segmentFormat, "mp4", StringComparison.OrdinalIgnoreCase))