aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-06-19 14:14:15 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-06-19 14:14:15 -0400
commit1de6b4607f82b2a3e18d8f1f4efa9248f7b0c98b (patch)
tree1cf414f1954a2c1fc463bfcf8c4ce58adf7da82b
parentce47f6338950853110ecc1d6bbd312b532b2ed8a (diff)
increase live stream analyze duration
-rw-r--r--Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs7
-rw-r--r--SocketHttpListener/Net/HttpListenerResponse.Managed.cs13
2 files changed, 14 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
index 12da1464b..75f423181 100644
--- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
+++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs
@@ -16,7 +16,8 @@ namespace Emby.Server.Implementations.LiveTv
private 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.LiveTv
Protocol = 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 this
mediaSource.InferTotalBitrate(true);
- mediaSource.AnalyzeDurationMs = AnalyzeDurationMs;
+ mediaSource.AnalyzeDurationMs = PlaybackAnalyzeDurationMs;
}
}
}
diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
index 9adf0d435..83fcc09ca 100644
--- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
+++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs
@@ -130,11 +130,18 @@ namespace SocketHttpListener.Net
var 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);
}