aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2020-09-07 20:00:23 +0000
committerGitHub <noreply@github.com>2020-09-07 20:00:23 +0000
commitc585af3177be921611d77901ac5b889ff7fb587c (patch)
treef754190083f343fac3b4f78d344131974053a53c
parent23f6616e63c23a4c1741a206db19408a6515d4d8 (diff)
parent15e064cb73e80c1dad72c90e8c6db52d3cad6e10 (diff)
Merge pull request #4063 from BaronGreenback/FilestreamResponse
Our of Memory fix when streaming large files
-rw-r--r--Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs9
-rw-r--r--Jellyfin.Api/Helpers/StreamingHelpers.cs1
2 files changed, 4 insertions, 6 deletions
diff --git a/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs b/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs
index 884bfbe44..6b516977e 100644
--- a/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs
+++ b/Jellyfin.Api/Helpers/FileStreamResponseHelpers.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Net.Http;
using System.Threading;
@@ -123,10 +123,9 @@ namespace Jellyfin.Api.Helpers
state.Dispose();
}
- var memoryStream = new MemoryStream();
- await new ProgressiveFileCopier(outputPath, job, transcodingJobHelper, CancellationToken.None).WriteToAsync(memoryStream, CancellationToken.None).ConfigureAwait(false);
- memoryStream.Position = 0;
- return new FileStreamResult(memoryStream, contentType);
+ await new ProgressiveFileCopier(outputPath, job, transcodingJobHelper, CancellationToken.None)
+ .WriteToAsync(httpContext.Response.Body, CancellationToken.None).ConfigureAwait(false);
+ return new FileStreamResult(httpContext.Response.Body, contentType);
}
finally
{
diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs
index c11799bc8..89ab2da62 100644
--- a/Jellyfin.Api/Helpers/StreamingHelpers.cs
+++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs
@@ -92,7 +92,6 @@ namespace Jellyfin.Api.Helpers
}
var enableDlnaHeaders = !string.IsNullOrWhiteSpace(streamingRequest.Params) ||
- streamingRequest.StreamOptions.ContainsKey("dlnaheaders") ||
string.Equals(httpRequest.Headers["GetContentFeatures.DLNA.ORG"], "1", StringComparison.OrdinalIgnoreCase);
var state = new StreamState(mediaSourceManager, transcodingJobType, transcodingJobHelper)