From e62270df353aa8e2ae0a20aeff7d5aa6f9b62630 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 24 Mar 2015 21:34:34 -0400 Subject: [PATCH] add socket error message --- MediaBrowser.Api/ApiEntryPoint.cs | 7 +++++++ MediaBrowser.Api/Playback/BaseStreamingService.cs | 2 +- MediaBrowser.Api/Playback/TranscodingThrottler.cs | 6 ++++++ .../HttpServer/SocketSharp/SharpWebSocket.cs | 3 ++- .../Session/WebSocketController.cs | 2 +- .../UserViews/StripCollageBuilder.cs | 2 +- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 281f764b5f..a21fc22fe3 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -407,6 +407,11 @@ namespace MediaBrowser.Api { try { + if (job.TranscodingThrottler != null) + { + job.TranscodingThrottler.Stop(); + } + Logger.Info("Killing ffmpeg process for {0}", job.Path); //process.Kill(); @@ -578,6 +583,8 @@ namespace MediaBrowser.Api public long? TranscodingPositionTicks { get; set; } public long? DownloadPositionTicks { get; set; } + public TranscodingThrottler TranscodingThrottler { get; set; } + public void DisposeKillTimer() { if (KillTimer != null) diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index ae71ac2625..bc194b45b0 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -1123,7 +1123,7 @@ namespace MediaBrowser.Api.Playback { if (state.RunTimeTicks.Value >= TimeSpan.FromMinutes(5).Ticks && state.IsInputVideo) { - state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger); + transcodingJob.TranscodingThrottler = state.TranscodingThrottler = new TranscodingThrottler(transcodingJob, Logger); state.TranscodingThrottler.Start(); } } diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs index 38ce9e2989..19a9fe9343 100644 --- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs +++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs @@ -139,6 +139,12 @@ namespace MediaBrowser.Api.Playback return false; } + public void Stop() + { + DisposeTimer(); + UnpauseTranscoding(); + } + public void Dispose() { DisposeTimer(); diff --git a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs index 8ab8b02151..a8b3bc10bc 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/SocketSharp/SharpWebSocket.cs @@ -56,7 +56,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp void socket_OnError(object sender, SocketHttpListener.ErrorEventArgs e) { - EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger); + _logger.Error("Error in SharpWebSocket: {0}", e.Message ?? string.Empty); + //EventHelper.FireEventIfNotNull(Closed, this, EventArgs.Empty, _logger); } void socket_OnClose(object sender, SocketHttpListener.CloseEventArgs e) diff --git a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs index d4ecd9572e..1e19495337 100644 --- a/MediaBrowser.Server.Implementations/Session/WebSocketController.cs +++ b/MediaBrowser.Server.Implementations/Session/WebSocketController.cs @@ -45,7 +45,7 @@ namespace MediaBrowser.Server.Implementations.Session { get { - return _isActive; + return HasOpenSockets; } } diff --git a/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs b/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs index 2f2d9860c1..00be0f18ee 100644 --- a/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs +++ b/MediaBrowser.Server.Implementations/UserViews/StripCollageBuilder.cs @@ -20,7 +20,7 @@ namespace MediaBrowser.Server.Implementations.UserViews public Stream BuildThumbCollage(IEnumerable paths, string text, int width, int height) { - using (var wand = BuildThumbCollageWandWithText(paths, text, width, height)) + using (var wand = BuildThumbCollageWand(paths, width, height)) { return DynamicImageHelpers.GetStream(wand, _appPaths); }