diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-03-31 15:41:12 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-03-31 15:41:12 -0400 |
| commit | be74de0236a3544959722b3a8ff9c9ca26c73d13 (patch) | |
| tree | 292d0abda239cd3966840b7e93568580209bf189 /MediaBrowser.Api/ApiEntryPoint.cs | |
| parent | aa079120059699f4778d80f55e68883d75d26b3a (diff) | |
| parent | 2626b6f3729097e083f381936738d17335f48f1c (diff) | |
Merge pull request #1058 from MediaBrowser/dev
3.0.5569.0
Diffstat (limited to 'MediaBrowser.Api/ApiEntryPoint.cs')
| -rw-r--r-- | MediaBrowser.Api/ApiEntryPoint.cs | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs index a21fc22fe..08ac5671d 100644 --- a/MediaBrowser.Api/ApiEntryPoint.cs +++ b/MediaBrowser.Api/ApiEntryPoint.cs @@ -132,7 +132,7 @@ namespace MediaBrowser.Api /// Called when [transcode beginning]. /// </summary> /// <param name="path">The path.</param> - /// <param name="streamId">The stream identifier.</param> + /// <param name="playSessionId">The play session identifier.</param> /// <param name="transcodingJobId">The transcoding job identifier.</param> /// <param name="type">The type.</param> /// <param name="process">The process.</param> @@ -141,7 +141,7 @@ namespace MediaBrowser.Api /// <param name="cancellationTokenSource">The cancellation token source.</param> /// <returns>TranscodingJob.</returns> public TranscodingJob OnTranscodeBeginning(string path, - string streamId, + string playSessionId, string transcodingJobId, TranscodingJobType type, Process process, @@ -160,7 +160,7 @@ namespace MediaBrowser.Api DeviceId = deviceId, CancellationTokenSource = cancellationTokenSource, Id = transcodingJobId, - StreamId = streamId + PlaySessionId = playSessionId }; _activeTranscodingJobs.Add(job); @@ -187,7 +187,7 @@ namespace MediaBrowser.Api if (!string.IsNullOrWhiteSpace(deviceId)) { - var audioCodec = state.ActualOutputVideoCodec; + var audioCodec = state.ActualOutputAudioCodec; var videoCodec = state.ActualOutputVideoCodec; _sessionManager.ReportTranscodingInfo(deviceId, new TranscodingInfo @@ -274,32 +274,37 @@ namespace MediaBrowser.Api return null; } - job.ActiveRequestCount++; - - job.DisposeKillTimer(); + OnTranscodeBeginRequest(job); return job; } } + public void OnTranscodeBeginRequest(TranscodingJob job) + { + job.ActiveRequestCount++; + + job.DisposeKillTimer(); + } + public void OnTranscodeEndRequest(TranscodingJob job) { job.ActiveRequestCount--; if (job.ActiveRequestCount == 0) { - if (job.Type == TranscodingJobType.Progressive) - { - const int timerDuration = 1000; + // TODO: Lower this hls timeout + var timerDuration = job.Type == TranscodingJobType.Progressive ? + 1000 : + 7200000; - if (job.KillTimer == null) - { - job.KillTimer = new Timer(OnTranscodeKillTimerStopped, job, timerDuration, Timeout.Infinite); - } - else - { - job.KillTimer.Change(timerDuration, Timeout.Infinite); - } + if (job.KillTimer == null) + { + job.KillTimer = new Timer(OnTranscodeKillTimerStopped, job, timerDuration, Timeout.Infinite); + } + else + { + job.KillTimer.Change(timerDuration, Timeout.Infinite); } } } @@ -319,10 +324,10 @@ namespace MediaBrowser.Api /// Kills the single transcoding job. /// </summary> /// <param name="deviceId">The device id.</param> - /// <param name="streamId">The stream identifier.</param> + /// <param name="playSessionId">The play session identifier.</param> /// <param name="deleteFiles">The delete files.</param> /// <returns>Task.</returns> - internal void KillTranscodingJobs(string deviceId, string streamId, Func<string, bool> deleteFiles) + internal void KillTranscodingJobs(string deviceId, string playSessionId, Func<string, bool> deleteFiles) { if (string.IsNullOrEmpty(deviceId)) { @@ -333,7 +338,7 @@ namespace MediaBrowser.Api { if (string.Equals(deviceId, j.DeviceId, StringComparison.OrdinalIgnoreCase)) { - return string.IsNullOrWhiteSpace(streamId) || string.Equals(streamId, j.StreamId, StringComparison.OrdinalIgnoreCase); + return string.IsNullOrWhiteSpace(playSessionId) || string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase); } return false; @@ -498,7 +503,7 @@ namespace MediaBrowser.Api .ToList(); Exception e = null; - + foreach (var file in filesToDelete) { try @@ -534,10 +539,10 @@ namespace MediaBrowser.Api public class TranscodingJob { /// <summary> - /// Gets or sets the stream identifier. + /// Gets or sets the play session identifier. /// </summary> - /// <value>The stream identifier.</value> - public string StreamId { get; set; } + /// <value>The play session identifier.</value> + public string PlaySessionId { get; set; } /// <summary> /// Gets or sets the path. /// </summary> |
