Throw if CancellationToken passed to CancellableThrough is not already cancelled

This commit is contained in:
Malte Rosenbjerg 2025-10-27 20:49:35 +01:00
parent 3b1a1438bb
commit 3c6cb1fb43

View file

@ -85,6 +85,7 @@ public class FFMpegArgumentProcessor
public FFMpegArgumentProcessor CancellableThrough(CancellationToken token, int timeout = 0)
{
token.ThrowIfCancellationRequested();
_cancellationTokenRegistration?.Dispose();
_cancellationTokenRegistration = token.Register(() => Cancel(timeout));
return this;