fix hdhr stream returning too quickly
This commit is contained in:
parent
5cb7469028
commit
83a43121af
|
@ -373,8 +373,6 @@ namespace Emby.Server.Implementations.Dto
|
|||
}
|
||||
|
||||
NormalizeMediaSourceContainers(dto);
|
||||
|
||||
dto.SupportsMediaSourceSelection = hasMediaSources.SupportsMediaSourceSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
|
||||
Logger.Info("Opened HDHR stream from {0}", url);
|
||||
|
||||
StartStreaming(response, LiveStreamCancellationTokenSource.Token);
|
||||
var taskCompletionSource = new TaskCompletionSource<bool>();
|
||||
StartStreaming(response, taskCompletionSource, LiveStreamCancellationTokenSource.Token);
|
||||
|
||||
//OpenedMediaSource.Protocol = MediaProtocol.File;
|
||||
//OpenedMediaSource.Path = tempFile;
|
||||
|
@ -71,6 +72,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
//OpenedMediaSource.SupportsDirectPlay = false;
|
||||
//OpenedMediaSource.SupportsDirectStream = true;
|
||||
//OpenedMediaSource.SupportsTranscoding = true;
|
||||
await taskCompletionSource.Task.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
protected override void CloseInternal()
|
||||
|
@ -78,7 +80,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
LiveStreamCancellationTokenSource.Cancel();
|
||||
}
|
||||
|
||||
private Task StartStreaming(HttpResponseInfo response, CancellationToken cancellationToken)
|
||||
private Task StartStreaming(HttpResponseInfo response, TaskCompletionSource<bool> openTaskCompletionSource, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
|
@ -90,10 +92,9 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
{
|
||||
Logger.Info("Beginning HdHomerunHttpStream stream to file");
|
||||
|
||||
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(TempFilePath));
|
||||
using (var fileStream = FileSystem.GetFileStream(TempFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, FileOpenOptions.None))
|
||||
{
|
||||
StreamHelper.CopyTo(stream, fileStream, 81920, null, cancellationToken);
|
||||
StreamHelper.CopyTo(stream, fileStream, 81920, () => Resolve(openTaskCompletionSource), cancellationToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,10 +113,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
|
||||
private void Resolve(TaskCompletionSource<bool> openTaskCompletionSource)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
openTaskCompletionSource.TrySetResult(true);
|
||||
});
|
||||
openTaskCompletionSource.TrySetResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,11 +51,6 @@ namespace MediaBrowser.Controller.Entities.Audio
|
|||
return 1;
|
||||
}
|
||||
|
||||
public bool SupportsMediaSourceSelection()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsPlayedStatus
|
||||
{
|
||||
|
|
|
@ -13,6 +13,5 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// <returns>Task{IEnumerable{MediaSourceInfo}}.</returns>
|
||||
List<MediaSourceInfo> GetMediaSources(bool enablePathSubstitution);
|
||||
List<MediaStream> GetMediaStreams();
|
||||
bool SupportsMediaSourceSelection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,11 +109,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsMediaSourceSelection()
|
||||
{
|
||||
return SourceType == SourceType.Library;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamp.
|
||||
/// </summary>
|
||||
|
|
|
@ -24,11 +24,6 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
return list;
|
||||
}
|
||||
|
||||
public bool SupportsMediaSourceSelection()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
return UnratedItem.LiveTvChannel;
|
||||
|
|
|
@ -75,7 +75,6 @@ namespace MediaBrowser.Model.Dto
|
|||
public bool? CanDownload { get; set; }
|
||||
|
||||
public bool? HasSubtitles { get; set; }
|
||||
public bool? SupportsMediaSourceSelection { get; set; }
|
||||
|
||||
public string PreferredMetadataLanguage { get; set; }
|
||||
public string PreferredMetadataCountryCode { get; set; }
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("3.2.36.2")]
|
||||
[assembly: AssemblyVersion("3.2.36.3")]
|
||||
|
|
Loading…
Reference in New Issue
Block a user