aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.MediaEncoding
diff options
context:
space:
mode:
authoralbarago <178173160+albarago@users.noreply.github.com>2026-11-26 14:51:52 -0600
committerGitHub <noreply@github.com>2026-11-26 21:51:52 +0100
commit51a3e2d462f9417ab9302b07e220b3eceb503143 (patch)
treea778502a48c6d0f75b6c99d394f89ee451b86d79 /MediaBrowser.MediaEncoding
parentd1da8bb96029f73a5c8bd7f7fb9675d434de06ba (diff)
Merge pull request #18761 from albarago/probe-cancelHEADmaster
Stop ffprobe when a metadata probe is cancelled or returns bad output
Diffstat (limited to 'MediaBrowser.MediaEncoding')
-rw-r--r--MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs14
1 files changed, 7 insertions, 7 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
index a751baf8b4..95095088c5 100644
--- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
+++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
@@ -549,28 +549,28 @@ namespace MediaBrowser.MediaEncoding.Encoder
{
StartProcess(processWrapper);
using var reader = process.StandardOutput;
- await reader.BaseStream.CopyToAsync(memoryStream, cancellationToken).ConfigureAwait(false);
- memoryStream.Seek(0, SeekOrigin.Begin);
InternalMediaInfoResult result;
try
{
+ await reader.BaseStream.CopyToAsync(memoryStream, cancellationToken).ConfigureAwait(false);
+ memoryStream.Seek(0, SeekOrigin.Begin);
result = await JsonSerializer.DeserializeAsync<InternalMediaInfoResult>(
memoryStream,
_jsonSerializerOptions,
cancellationToken).ConfigureAwait(false);
+ if (result is null || (result.Streams is null && result.Format is null))
+ {
+ throw new FfmpegException("ffprobe failed - streams and format are both null.");
+ }
}
catch
{
+ // Cancellation while copying stdout must stop the probe before the wrapper unregisters it.
StopProcess(processWrapper, 100);
throw;
}
- if (result is null || (result.Streams is null && result.Format is null))
- {
- throw new FfmpegException("ffprobe failed - streams and format are both null.");
- }
-
if (result.Streams is not null)
{
// Normalize aspect ratio if invalid