aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/ApiEntryPoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/ApiEntryPoint.cs')
-rw-r--r--MediaBrowser.Api/ApiEntryPoint.cs55
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>