diff options
| author | Vasily <JustAMan@users.noreply.github.com> | 2019-02-04 14:10:08 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-04 14:10:08 +0300 |
| commit | 83af2db679bb3b06243b122825653bdb86f2fc27 (patch) | |
| tree | de34e7ebdfd25c83190e5903d8b444b6e2b00765 /MediaBrowser.Api/Playback/TranscodingThrottler.cs | |
| parent | 0b3e6548dbea5db4d31e3947cc2406852d8e3733 (diff) | |
| parent | cb7bffc233bcdb1dfb2b6be629dc8f13e482cd3b (diff) | |
Merge pull request #798 from Bond-009/apientrypoint
Cleanup around the api endpoints
Diffstat (limited to 'MediaBrowser.Api/Playback/TranscodingThrottler.cs')
| -rw-r--r-- | MediaBrowser.Api/Playback/TranscodingThrottler.cs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/MediaBrowser.Api/Playback/TranscodingThrottler.cs b/MediaBrowser.Api/Playback/TranscodingThrottler.cs index 97f21c8f3..9f416098a 100644 --- a/MediaBrowser.Api/Playback/TranscodingThrottler.cs +++ b/MediaBrowser.Api/Playback/TranscodingThrottler.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.IO; @@ -36,7 +37,7 @@ namespace MediaBrowser.Api.Playback _timer = _timerFactory.Create(TimerCallback, null, 5000, 5000); } - private void TimerCallback(object state) + private async void TimerCallback(object state) { if (_job.HasExited) { @@ -48,15 +49,15 @@ namespace MediaBrowser.Api.Playback if (options.EnableThrottling && IsThrottleAllowed(_job, options.ThrottleDelaySeconds)) { - PauseTranscoding(); + await PauseTranscoding(); } else { - UnpauseTranscoding(); + await UnpauseTranscoding(); } } - private void PauseTranscoding() + private async Task PauseTranscoding() { if (!_isPaused) { @@ -64,7 +65,7 @@ namespace MediaBrowser.Api.Playback try { - _job.Process.StandardInput.Write("c"); + await _job.Process.StandardInput.WriteAsync("c"); _isPaused = true; } catch (Exception ex) @@ -74,7 +75,7 @@ namespace MediaBrowser.Api.Playback } } - public void UnpauseTranscoding() + public async Task UnpauseTranscoding() { if (_isPaused) { @@ -82,7 +83,7 @@ namespace MediaBrowser.Api.Playback try { - _job.Process.StandardInput.WriteLine(); + await _job.Process.StandardInput.WriteLineAsync(); _isPaused = false; } catch (Exception ex) @@ -153,10 +154,10 @@ namespace MediaBrowser.Api.Playback return false; } - public void Stop() + public async Task Stop() { DisposeTimer(); - UnpauseTranscoding(); + await UnpauseTranscoding(); } public void Dispose() |
