2
0
Эх сурвалжийг харах

Trickplay: kill ffmpeg when task is cancelled (#11790)

NotSaifA 1 жил өмнө
parent
commit
4a344bebc0

+ 1 - 0
CONTRIBUTORS.md

@@ -183,6 +183,7 @@
  - [btopherjohnson](https://github.com/btopherjohnson)
  - [btopherjohnson](https://github.com/btopherjohnson)
  - [GeorgeH005](https://github.com/GeorgeH005)
  - [GeorgeH005](https://github.com/GeorgeH005)
  - [Vedant](https://github.com/viktory36/)
  - [Vedant](https://github.com/viktory36/)
+ - [NotSaifA](https://github.com/NotSaifA)
 
 
 # Emby Contributors
 # Emby Contributors
 
 

+ 7 - 4
MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs

@@ -959,7 +959,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
                     var timeoutMs = _configurationManager.Configuration.ImageExtractionTimeoutMs;
                     var timeoutMs = _configurationManager.Configuration.ImageExtractionTimeoutMs;
                     timeoutMs = timeoutMs <= 0 ? DefaultHdrImageExtractionTimeout : timeoutMs;
                     timeoutMs = timeoutMs <= 0 ? DefaultHdrImageExtractionTimeout : timeoutMs;
 
 
-                    while (isResponsive)
+                    while (isResponsive && !cancellationToken.IsCancellationRequested)
                     {
                     {
                         try
                         try
                         {
                         {
@@ -973,8 +973,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
                             // We don't actually expect the process to be finished in one timeout span, just that one image has been generated.
                             // We don't actually expect the process to be finished in one timeout span, just that one image has been generated.
                         }
                         }
 
 
-                        cancellationToken.ThrowIfCancellationRequested();
-
                         var jpegCount = _fileSystem.GetFilePaths(targetDirectory).Count();
                         var jpegCount = _fileSystem.GetFilePaths(targetDirectory).Count();
 
 
                         isResponsive = jpegCount > lastCount;
                         isResponsive = jpegCount > lastCount;
@@ -983,7 +981,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
 
 
                     if (!ranToCompletion)
                     if (!ranToCompletion)
                     {
                     {
-                        _logger.LogInformation("Stopping trickplay extraction due to process inactivity.");
+                        if (!isResponsive)
+                        {
+                            _logger.LogInformation("Trickplay process unresponsive.");
+                        }
+
+                        _logger.LogInformation("Stopping trickplay extraction.");
                         StopProcess(processWrapper, 1000);
                         StopProcess(processWrapper, 1000);
                     }
                     }
                 }
                 }