Apply patch
This commit is contained in:
parent
5d88e61076
commit
b4d52d8009
|
@ -131,6 +131,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
await taskCompletionSource.Task.ConfigureAwait(false);
|
await taskCompletionSource.Task.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetFilePath()
|
||||||
|
{
|
||||||
|
return TempFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
private Task StartStreaming(UdpClient udpClient, HdHomerunManager hdHomerunManager, IPAddress remoteAddress, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
private Task StartStreaming(UdpClient udpClient, HdHomerunManager hdHomerunManager, IPAddress remoteAddress, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return Task.Run(async () =>
|
return Task.Run(async () =>
|
||||||
|
|
|
@ -122,6 +122,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetFilePath()
|
||||||
|
{
|
||||||
|
return TempFilePath;
|
||||||
|
}
|
||||||
|
|
||||||
private Task StartStreaming(HttpResponseMessage response, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
private Task StartStreaming(HttpResponseMessage response, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
return Task.Run(async () =>
|
return Task.Run(async () =>
|
||||||
|
|
|
@ -1220,11 +1220,8 @@ namespace Jellyfin.Api.Controllers
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
await new ProgressiveFileCopier(liveStreamInfo, null, _transcodingJobHelper, CancellationToken.None)
|
var liveStream = new ProgressiveFileStream(liveStreamInfo.GetFilePath(), null, _transcodingJobHelper);
|
||||||
.WriteToAsync(Response.Body, CancellationToken.None)
|
return new FileStreamResult(liveStream, MimeTypes.GetMimeType("file." + container));
|
||||||
.ConfigureAwait(false);
|
|
||||||
Response.ContentType = MimeTypes.GetMimeType("file." + container);
|
|
||||||
return Ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AssertUserCanManageLiveTv()
|
private void AssertUserCanManageLiveTv()
|
||||||
|
|
|
@ -82,20 +82,23 @@ namespace Jellyfin.Api.Helpers
|
||||||
int totalBytesRead = 0;
|
int totalBytesRead = 0;
|
||||||
int remainingBytesToRead = count;
|
int remainingBytesToRead = count;
|
||||||
|
|
||||||
|
int newOffset = offset;
|
||||||
while (remainingBytesToRead > 0)
|
while (remainingBytesToRead > 0)
|
||||||
{
|
{
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
int bytesRead;
|
int bytesRead;
|
||||||
if (_allowAsyncFileRead)
|
if (_allowAsyncFileRead)
|
||||||
{
|
{
|
||||||
bytesRead = await _fileStream.ReadAsync(buffer, offset, remainingBytesToRead, cancellationToken).ConfigureAwait(false);
|
bytesRead = await _fileStream.ReadAsync(buffer, newOffset, remainingBytesToRead, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bytesRead = _fileStream.Read(buffer, offset, remainingBytesToRead);
|
bytesRead = _fileStream.Read(buffer, newOffset, remainingBytesToRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingBytesToRead -= bytesRead;
|
remainingBytesToRead -= bytesRead;
|
||||||
|
newOffset += bytesRead;
|
||||||
|
|
||||||
if (bytesRead > 0)
|
if (bytesRead > 0)
|
||||||
{
|
{
|
||||||
_bytesWritten += bytesRead;
|
_bytesWritten += bytesRead;
|
||||||
|
@ -108,12 +111,13 @@ namespace Jellyfin.Api.Helpers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_job == null || _job.HasExited)
|
// If the job is null it's a live stream and will require user action to close
|
||||||
|
if (_job?.HasExited ?? false)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.Delay(100, cancellationToken).ConfigureAwait(false);
|
await Task.Delay(50, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,5 +115,7 @@ namespace MediaBrowser.Controller.Library
|
||||||
public interface IDirectStreamProvider
|
public interface IDirectStreamProvider
|
||||||
{
|
{
|
||||||
Task CopyToAsync(Stream stream, CancellationToken cancellationToken);
|
Task CopyToAsync(Stream stream, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
string GetFilePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user