diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-21 23:15:26 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-03-21 23:15:26 -0400 |
| commit | e15a4328fb0930d3554365e1b6ed2adc2aa161bb (patch) | |
| tree | ce873007155a2e72c3c4f74e0d4a3ed03b3c67c8 | |
| parent | 95250b9f220dbd3a5bc6c11cbdc983967b8574d4 (diff) | |
fix progress ping
| -rw-r--r-- | MediaBrowser.Api/ApiEntryPoint.cs | 14 | ||||
| -rw-r--r-- | MediaBrowser.Api/UserLibrary/PlaystateService.cs | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index 55f191f1a..47a339d2b 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -300,26 +300,31 @@ namespace MediaBrowser.Api PingTimer(job, false); } } - internal void PingTranscodingJob(string playSessionId) + internal void PingTranscodingJob(string playSessionId, bool? isUserPaused) { if (string.IsNullOrEmpty(playSessionId)) { throw new ArgumentNullException("playSessionId"); } - //Logger.Debug("PingTranscodingJob PlaySessionId={0}", playSessionId); + //Logger.Debug("PingTranscodingJob PlaySessionId={0} isUsedPaused: {1}", playSessionId, isUserPaused); - var jobs = new List<TranscodingJob>(); + List<TranscodingJob> jobs; lock (_activeTranscodingJobs) { // This is really only needed for HLS. // Progressive streams can stop on their own reliably - jobs = jobs.Where(j => string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase)).ToList(); + jobs = _activeTranscodingJobs.Where(j => string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase)).ToList(); } foreach (var job in jobs) { + if (isUserPaused.HasValue) + { + //Logger.Debug("Setting job.IsUserPaused to {0}. jobId: {1}", isUserPaused, job.Id); + job.IsUserPaused = isUserPaused.Value; + } PingTimer(job, true); } } @@ -655,6 +660,7 @@ namespace MediaBrowser.Api public object ProcessLock = new object(); public bool HasExited { get; set; } + public bool IsUserPaused { get; set; } public string Id { get; set; } diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index 08c6b0ba4..ddb73c2a6 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -337,7 +337,7 @@ namespace MediaBrowser.Api.UserLibrary { if (!string.IsNullOrWhiteSpace(request.PlaySessionId)) { - ApiEntryPoint.Instance.PingTranscodingJob(request.PlaySessionId); + ApiEntryPoint.Instance.PingTranscodingJob(request.PlaySessionId, request.IsPaused); } request.SessionId = GetSession().Result.Id; @@ -349,7 +349,7 @@ namespace MediaBrowser.Api.UserLibrary public void Post(PingPlaybackSession request) { - ApiEntryPoint.Instance.PingTranscodingJob(request.PlaySessionId); + ApiEntryPoint.Instance.PingTranscodingJob(request.PlaySessionId, null); } /// <summary> |
