aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback/BaseStreamingService.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-12-06 12:06:13 +0100
committerBond-009 <bond.009@outlook.com>2019-12-06 12:06:13 +0100
commita2c35e6dba02f068a3f06e5a4e4964e6539069d1 (patch)
treee75984ab85fedceaf96150ad9d5241cf88230a60 /MediaBrowser.Api/Playback/BaseStreamingService.cs
parent94edb5b9f98cf3b06144255eccc988712332f0a8 (diff)
parent935525e77a18061195dea786be71d38fffe82a10 (diff)
Merge remote-tracking branch 'upstream/master' into random
Diffstat (limited to 'MediaBrowser.Api/Playback/BaseStreamingService.cs')
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 8c4ccfa22..4bd729aac 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Devices;
@@ -141,7 +142,7 @@ namespace MediaBrowser.Api.Playback
var filename = data.GetMD5().ToString("N", CultureInfo.InvariantCulture);
var ext = outputFileExtension.ToLowerInvariant();
- var folder = ServerConfigurationManager.ApplicationPaths.TranscodingTempPath;
+ var folder = ServerConfigurationManager.GetTranscodePath();
if (EnableOutputInSubFolder)
{
@@ -215,7 +216,7 @@ namespace MediaBrowser.Api.Playback
}
}
- var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
+ var encodingOptions = ServerConfigurationManager.GetEncodingOptions();
var process = new Process()
{
@@ -289,17 +290,22 @@ namespace MediaBrowser.Api.Playback
throw;
}
+ Logger.LogDebug("Launched ffmpeg process");
state.TranscodingJob = transcodingJob;
// Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
_ = new JobLogger(Logger).StartStreamingLog(state, process.StandardError.BaseStream, logStream);
// Wait for the file to exist before proceeeding
- while (!File.Exists(state.WaitForPath ?? outputPath) && !transcodingJob.HasExited)
+ var ffmpegTargetFile = state.WaitForPath ?? outputPath;
+ Logger.LogDebug("Waiting for the creation of {0}", ffmpegTargetFile);
+ while (!File.Exists(ffmpegTargetFile) && !transcodingJob.HasExited)
{
await Task.Delay(100, cancellationTokenSource.Token).ConfigureAwait(false);
}
+ Logger.LogDebug("File {0} created or transcoding has finished", ffmpegTargetFile);
+
if (state.IsInputVideo && transcodingJob.Type == TranscodingJobType.Progressive && !transcodingJob.HasExited)
{
await Task.Delay(1000, cancellationTokenSource.Token).ConfigureAwait(false);
@@ -314,6 +320,7 @@ namespace MediaBrowser.Api.Playback
{
StartThrottler(state, transcodingJob);
}
+ Logger.LogDebug("StartFfMpeg() finished successfully");
return transcodingJob;
}
@@ -582,7 +589,7 @@ namespace MediaBrowser.Api.Playback
/// <summary>
/// Parses query parameters as StreamOptions
- /// <summary>
+ /// </summary>
/// <param name="request">The stream request.</param>
private void ParseStreamOptions(StreamRequest request)
{
@@ -839,7 +846,7 @@ namespace MediaBrowser.Api.Playback
? GetOutputFileExtension(state)
: ('.' + state.OutputContainer);
- var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
+ var encodingOptions = ServerConfigurationManager.GetEncodingOptions();
state.OutputFilePath = GetOutputFilePath(state, encodingOptions, ext);