diff options
| author | Nick <20588554+nicknsy@users.noreply.github.com> | 2023-10-18 20:01:40 -0700 |
|---|---|---|
| committer | Nick <20588554+nicknsy@users.noreply.github.com> | 2023-10-18 20:01:40 -0700 |
| commit | 6b94d55e1ef7ca95e0ddc2a88b0ff0fd63d630a9 (patch) | |
| tree | edc6ad0f1f241c2c3c2cdba5359d4d3006636d33 | |
| parent | cd662506a1f63f9b20e7f5caa9b671eb3d71ea5a (diff) | |
Fix for new WaitForExitAsync method
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index 0b603715d..4668b8bbb 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -920,14 +920,22 @@ namespace MediaBrowser.MediaEncoding.Encoder bool isResponsive = true; int lastCount = 0; + var timeoutMs = _configurationManager.Configuration.ImageExtractionTimeoutMs; + timeoutMs = timeoutMs <= 0 ? DefaultHdrImageExtractionTimeout : timeoutMs; while (isResponsive) { - if (await process.WaitForExitAsync(TimeSpan.FromSeconds(30)).ConfigureAwait(false)) + try { + await process.WaitForExitAsync(TimeSpan.FromMilliseconds(timeoutMs)).ConfigureAwait(false); + ranToCompletion = true; break; } + catch (OperationCanceledException) + { + // We don't actually expect the process to be finished in one timeout span, just that one image has been generated. + } cancellationToken.ThrowIfCancellationRequested(); @@ -939,7 +947,7 @@ namespace MediaBrowser.MediaEncoding.Encoder if (!ranToCompletion) { - _logger.LogInformation("Killing ffmpeg extraction process due to inactivity."); + _logger.LogInformation("Stopping trickplay extraction due to process inactivity."); StopProcess(processWrapper, 1000); } } |
