diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 9609d8c29..5cae4c3f7 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -607,7 +607,7 @@ namespace MediaBrowser.Api.Playback } } - // TODO: Perhaps also use original_size=1920x800 + // TODO: Perhaps also use original_size=1920x800 ?? return string.Format("subtitles=filename='{0}'{1},setpts=PTS -{2}/TB", subtitlePath.Replace('\\', '/').Replace(":/", "\\:/"), charsetParam, @@ -817,7 +817,7 @@ namespace MediaBrowser.Api.Playback state.MediaPath = streamInfo.Path; state.InputProtocol = MediaProtocol.File; - await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false); + await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false); } else if (!string.IsNullOrEmpty(streamInfo.Url)) { @@ -838,7 +838,7 @@ namespace MediaBrowser.Api.Playback state.MediaPath = streamInfo.Path; state.InputProtocol = MediaProtocol.File; - await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false); + await Task.Delay(1500, cancellationTokenSource.Token).ConfigureAwait(false); } else if (!string.IsNullOrEmpty(streamInfo.Url)) { @@ -943,19 +943,6 @@ namespace MediaBrowser.Api.Playback { await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false); } - - // Allow a small amount of time to buffer a little - // But not with HLS because it already has it's own wait - if (state.IsInputVideo && TranscodingJobType != TranscodingJobType.Hls) - { - await Task.Delay(500, cancellationTokenSource.Token).ConfigureAwait(false); - } - - // This is arbitrary, but add a little buffer time when internet streaming - if (state.InputProtocol != MediaProtocol.File) - { - await Task.Delay(2500, cancellationTokenSource.Token).ConfigureAwait(false); - } } private async void StartStreamingLog(StreamState state, Stream source, Stream target) @@ -1458,11 +1445,6 @@ namespace MediaBrowser.Api.Playback state.RunTimeTicks = recording.RunTimeTicks; - if (recording.RecordingInfo.Status == RecordingStatus.InProgress) - { - await Task.Delay(1000, cancellationToken).ConfigureAwait(false); - } - state.OutputAudioSync = "1000"; state.InputVideoSync = "-1"; state.InputAudioSync = "1"; diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index 8eff75533..317c4455a 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -104,7 +104,10 @@ namespace MediaBrowser.Api.Playback.Hls } else { - await ApiEntryPoint.Instance.KillTranscodingJobs(state.Request.DeviceId, TranscodingJobType.Hls, p => true, false).ConfigureAwait(false); + if (!string.IsNullOrWhiteSpace(state.Request.DeviceId)) + { + await ApiEntryPoint.Instance.KillTranscodingJobs(state.Request.DeviceId, TranscodingJobType.Hls, p => true, false).ConfigureAwait(false); + } // If the playlist doesn't already exist, startup ffmpeg try diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index 5efb39cbc..11a5cdf08 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -107,7 +107,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager return client; } - private PropertyInfo _httpBehaviorPropertyInfo; private WebRequest GetRequest(HttpRequestOptions options, string method, bool enableHttpCompression) { var request = (HttpWebRequest)WebRequest.Create(options.Url); @@ -118,7 +117,11 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.CachePolicy = new RequestCachePolicy(RequestCacheLevel.BypassCache); - request.KeepAlive = options.EnableKeepAlive; + if (options.EnableKeepAlive) + { + request.KeepAlive = true; + } + request.Method = method; request.Pipelined = true; request.Timeout = 20000; @@ -133,21 +136,6 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager request.Referer = options.Referer; } -#if !__MonoCS__ - if (options.EnableKeepAlive) - { - // This is a hack to prevent KeepAlive from getting disabled internally by the HttpWebRequest - // May need to remove this for mono - var sp = request.ServicePoint; - if (_httpBehaviorPropertyInfo == null) - { - _httpBehaviorPropertyInfo = sp.GetType().GetProperty("HttpBehaviour", BindingFlags.Instance | BindingFlags.NonPublic); - } - - _httpBehaviorPropertyInfo.SetValue(sp, (byte)0, null); - } -#endif - return request; } diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index 3cba84334..a2b42dedb 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -106,7 +106,6 @@ namespace MediaBrowser.Common.Net { EnableHttpCompression = true; BufferContent = true; - EnableKeepAlive = true; RequestHeaders = new Dictionary(StringComparer.OrdinalIgnoreCase); diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 21476c5d9..048a7a0cf 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -37,7 +37,7 @@ namespace MediaBrowser.Dlna _logger = logger; _jsonSerializer = jsonSerializer; - //DumpProfiles(); + DumpProfiles(); } public IEnumerable GetProfiles() @@ -75,6 +75,10 @@ namespace MediaBrowser.Dlna new LgTvProfile(), new Foobar2000Profile(), new MediaMonkeyProfile(), + new Windows81Profile(), + //new WindowsMediaCenterProfile(), + new WindowsPhoneProfile(), + new AndroidProfile(), new DefaultProfile() }; diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj index 94f9c0391..e3a5289f5 100644 --- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj +++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj @@ -82,6 +82,7 @@ + @@ -174,6 +175,11 @@ + + + + +