mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-09 07:10:34 +02:00
Merge pull request #4063 from BaronGreenback/FilestreamResponse
Our of Memory fix when streaming large files
This commit is contained in:
commit
c585af3177
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
@ -123,10 +123,9 @@ namespace Jellyfin.Api.Helpers
|
||||||
state.Dispose();
|
state.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
var memoryStream = new MemoryStream();
|
await new ProgressiveFileCopier(outputPath, job, transcodingJobHelper, CancellationToken.None)
|
||||||
await new ProgressiveFileCopier(outputPath, job, transcodingJobHelper, CancellationToken.None).WriteToAsync(memoryStream, CancellationToken.None).ConfigureAwait(false);
|
.WriteToAsync(httpContext.Response.Body, CancellationToken.None).ConfigureAwait(false);
|
||||||
memoryStream.Position = 0;
|
return new FileStreamResult(httpContext.Response.Body, contentType);
|
||||||
return new FileStreamResult(memoryStream, contentType);
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,6 @@ namespace Jellyfin.Api.Helpers
|
||||||
}
|
}
|
||||||
|
|
||||||
var enableDlnaHeaders = !string.IsNullOrWhiteSpace(streamingRequest.Params) ||
|
var enableDlnaHeaders = !string.IsNullOrWhiteSpace(streamingRequest.Params) ||
|
||||||
streamingRequest.StreamOptions.ContainsKey("dlnaheaders") ||
|
|
||||||
string.Equals(httpRequest.Headers["GetContentFeatures.DLNA.ORG"], "1", StringComparison.OrdinalIgnoreCase);
|
string.Equals(httpRequest.Headers["GetContentFeatures.DLNA.ORG"], "1", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var state = new StreamState(mediaSourceManager, transcodingJobType, transcodingJobHelper)
|
var state = new StreamState(mediaSourceManager, transcodingJobType, transcodingJobHelper)
|
||||||
|
|
Loading…
Reference in a new issue