The Free Software Media System - Server Backend & API
increase live stream analyze duration
Luke Pulverenti1de6b4607f82
diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.csindex 12da1464bc..75f4231816 100644--- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs+++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs@@ -16,7 +16,8 @@ namespace Emby.Server.Implementations.LiveTvprivate readonly IMediaEncoder _mediaEncoder;private readonly ILogger _logger;- const int AnalyzeDurationMs = 1000;+ const int ProbeAnalyzeDurationMs = 2000;+ const int PlaybackAnalyzeDurationMs = 1000;public LiveStreamHelper(IMediaEncoder mediaEncoder, ILogger logger){@@ -36,7 +37,7 @@ namespace Emby.Server.Implementations.LiveTvProtocol = mediaSource.Protocol,MediaType = isAudio ? DlnaProfileType.Audio : DlnaProfileType.Video,ExtractChapters = false,- AnalyzeDurationMs = AnalyzeDurationMs+ AnalyzeDurationMs = ProbeAnalyzeDurationMs}, cancellationToken).ConfigureAwait(false);@@ -106,7 +107,7 @@ namespace Emby.Server.Implementations.LiveTv// Try to estimate thismediaSource.InferTotalBitrate(true);- mediaSource.AnalyzeDurationMs = AnalyzeDurationMs;+ mediaSource.AnalyzeDurationMs = PlaybackAnalyzeDurationMs;}}}diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.csindex 9adf0d435d..83fcc09cae 100644--- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs+++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs@@ -130,11 +130,18 @@ namespace SocketHttpListener.Netvar thisRef = (HttpListenerResponse)iar.AsyncState;try{- thisRef.OutputStream.EndWrite(iar);+ try+ {+ thisRef.OutputStream.EndWrite(iar);+ }+ finally+ {+ thisRef.Close(false);+ }}- finally+ catch (Exception){- thisRef.Close(false);+ // In case response was disposed during this time}}, this);}