aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs12
-rw-r--r--MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs6
2 files changed, 16 insertions, 2 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 98004dfcb..510808778 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -318,7 +318,17 @@ namespace MediaBrowser.Api.Playback
if (videoCodec.Equals("libx264", StringComparison.OrdinalIgnoreCase))
{
- return "-preset superfast";
+ switch (GetQualitySetting())
+ {
+ case EncodingQuality.HighSpeed:
+ return "-preset ultrafast";
+ case EncodingQuality.HighQuality:
+ return "-preset superfast";
+ case EncodingQuality.MaxQuality:
+ return "-preset superfast";
+ default:
+ throw new Exception("Unrecognized MediaEncodingQuality value.");
+ }
}
if (videoCodec.Equals("mpeg4", StringComparison.OrdinalIgnoreCase))
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
index 477dc4aee..d23106266 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/ScheduledTaskWorker.cs
@@ -380,6 +380,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
CurrentProgress = null;
OnTaskCompleted(startTime, endTime, status, failureException);
+
+ // Bad practice, i know. But we keep a lot in memory, unfortunately.
+ GC.Collect(2, GCCollectionMode.Forced, true);
+ GC.Collect(2, GCCollectionMode.Forced, true);
}
/// <summary>
@@ -390,7 +394,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
/// <returns>Task.</returns>
private Task ExecuteTask(CancellationToken cancellationToken, IProgress<double> progress)
{
- return Task.Run(async () => await ScheduledTask.Execute(cancellationToken, progress).ConfigureAwait(false));
+ return Task.Run(async () => await ScheduledTask.Execute(cancellationToken, progress).ConfigureAwait(false), cancellationToken);
}
/// <summary>