|
@@ -102,7 +102,7 @@ namespace Jellyfin.Api.Helpers
|
|
|
/// </summary>
|
|
|
/// <param name="playSessionId">Playback session id.</param>
|
|
|
/// <returns>The transcoding job.</returns>
|
|
|
- public TranscodingJobDto GetTranscodingJob(string playSessionId)
|
|
|
+ public TranscodingJobDto? GetTranscodingJob(string playSessionId)
|
|
|
{
|
|
|
lock (_activeTranscodingJobs)
|
|
|
{
|
|
@@ -116,7 +116,7 @@ namespace Jellyfin.Api.Helpers
|
|
|
/// <param name="path">Path to the transcoding file.</param>
|
|
|
/// <param name="type">The <see cref="TranscodingJobType"/>.</param>
|
|
|
/// <returns>The transcoding job.</returns>
|
|
|
- public TranscodingJobDto GetTranscodingJob(string path, TranscodingJobType type)
|
|
|
+ public TranscodingJobDto? GetTranscodingJob(string path, TranscodingJobType type)
|
|
|
{
|
|
|
lock (_activeTranscodingJobs)
|
|
|
{
|
|
@@ -193,9 +193,13 @@ namespace Jellyfin.Api.Helpers
|
|
|
/// Called when [transcode kill timer stopped].
|
|
|
/// </summary>
|
|
|
/// <param name="state">The state.</param>
|
|
|
- private async void OnTranscodeKillTimerStopped(object state)
|
|
|
+ private async void OnTranscodeKillTimerStopped(object? state)
|
|
|
{
|
|
|
- var job = (TranscodingJobDto)state;
|
|
|
+ var job = (TranscodingJobDto?)state;
|
|
|
+ if (job == null)
|
|
|
+ {
|
|
|
+ throw new NullReferenceException(nameof(job));
|
|
|
+ }
|
|
|
|
|
|
if (!job.HasExited && job.Type != TranscodingJobType.Progressive)
|
|
|
{
|
|
@@ -489,7 +493,13 @@ namespace Jellyfin.Api.Helpers
|
|
|
CancellationTokenSource cancellationTokenSource,
|
|
|
string? workingDirectory = null)
|
|
|
{
|
|
|
- Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
|
|
|
+ var directory = Path.GetDirectoryName(outputPath);
|
|
|
+ if (directory == null)
|
|
|
+ {
|
|
|
+ throw new NullReferenceException(nameof(directory));
|
|
|
+ }
|
|
|
+
|
|
|
+ Directory.CreateDirectory(directory);
|
|
|
|
|
|
await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false);
|
|
|
|
|
@@ -523,7 +533,7 @@ namespace Jellyfin.Api.Helpers
|
|
|
RedirectStandardInput = true,
|
|
|
FileName = _mediaEncoder.EncoderPath,
|
|
|
Arguments = commandLineArguments,
|
|
|
- WorkingDirectory = string.IsNullOrWhiteSpace(workingDirectory) ? null : workingDirectory,
|
|
|
+ WorkingDirectory = string.IsNullOrWhiteSpace(workingDirectory) ? string.Empty : workingDirectory,
|
|
|
ErrorDialog = false
|
|
|
},
|
|
|
EnableRaisingEvents = true
|
|
@@ -827,7 +837,7 @@ namespace Jellyfin.Api.Helpers
|
|
|
{
|
|
|
lock (_transcodingLocks)
|
|
|
{
|
|
|
- if (!_transcodingLocks.TryGetValue(outputPath, out SemaphoreSlim result))
|
|
|
+ if (!_transcodingLocks.TryGetValue(outputPath, out SemaphoreSlim? result))
|
|
|
{
|
|
|
result = new SemaphoreSlim(1, 1);
|
|
|
_transcodingLocks[outputPath] = result;
|
|
@@ -837,7 +847,7 @@ namespace Jellyfin.Api.Helpers
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void OnPlaybackProgress(object sender, PlaybackProgressEventArgs e)
|
|
|
+ private void OnPlaybackProgress(object? sender, PlaybackProgressEventArgs e)
|
|
|
{
|
|
|
if (!string.IsNullOrWhiteSpace(e.PlaySessionId))
|
|
|
{
|