浏览代码

Merge pull request #7542 from 1337joe/make-recording-stop

Make recording stop at scheduled stop time
Cody Robibero 3 年之前
父节点
当前提交
132c85e554
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs

+ 5 - 2
Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs

@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
 
 
             await RecordFromFile(mediaSource, mediaSource.Path, targetFile, onStarted, cancellationTokenSource.Token).ConfigureAwait(false);
             await RecordFromFile(mediaSource, mediaSource.Path, targetFile, onStarted, cancellationTokenSource.Token).ConfigureAwait(false);
 
 
-            _logger.LogInformation("Recording completed to file {0}", targetFile);
+            _logger.LogInformation("Recording completed to file {Path}", targetFile);
         }
         }
 
 
         private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, Action onStarted, CancellationToken cancellationToken)
         private async Task RecordFromFile(MediaSourceInfo mediaSource, string inputFile, string targetFile, Action onStarted, CancellationToken cancellationToken)
@@ -115,7 +115,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
             // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
             // Important - don't await the log task or we won't be able to kill ffmpeg when the user stops playback
             _ = StartStreamingLog(_process.StandardError.BaseStream, _logFileStream);
             _ = StartStreamingLog(_process.StandardError.BaseStream, _logFileStream);
 
 
-            _logger.LogInformation("ffmpeg recording process started for {0}", _targetPath);
+            _logger.LogInformation("ffmpeg recording process started for {Path}", _targetPath);
+
+            // Block until ffmpeg exits
+            await _taskCompletionSource.Task.ConfigureAwait(false);
         }
         }
 
 
         private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile)
         private string GetCommandLineArgs(MediaSourceInfo mediaSource, string inputTempFile, string targetFile)