mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-12-14 10:05:44 +00:00
Add test verifying cancellation before processing starts
This commit is contained in:
parent
e01b73787d
commit
4baddaab7f
1 changed files with 22 additions and 0 deletions
|
|
@ -1043,6 +1043,28 @@ public class VideoTest
|
||||||
Assert.ThrowsExactly<OperationCanceledException>(() => task.ProcessSynchronously());
|
Assert.ThrowsExactly<OperationCanceledException>(() => task.ProcessSynchronously());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
[Timeout(BaseTimeoutMilliseconds, CooperativeCancellation = true)]
|
||||||
|
public void Video_Cancel_CancellationToken_Before_Throws()
|
||||||
|
{
|
||||||
|
using var outputFile = new TemporaryFile("out.mp4");
|
||||||
|
|
||||||
|
var cts = new CancellationTokenSource();
|
||||||
|
|
||||||
|
cts.Cancel();
|
||||||
|
var task = FFMpegArguments
|
||||||
|
.FromFileInput("testsrc2=size=320x240[out0]; sine[out1]", false, args => args
|
||||||
|
.WithCustomArgument("-re")
|
||||||
|
.ForceFormat("lavfi"))
|
||||||
|
.OutputToFile(outputFile, false, opt => opt
|
||||||
|
.WithAudioCodec(AudioCodec.Aac)
|
||||||
|
.WithVideoCodec(VideoCodec.LibX264)
|
||||||
|
.WithSpeedPreset(Speed.VeryFast))
|
||||||
|
.CancellableThrough(cts.Token);
|
||||||
|
|
||||||
|
Assert.ThrowsExactly<OperationCanceledException>(() => task.ProcessSynchronously());
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
[Timeout(BaseTimeoutMilliseconds, CooperativeCancellation = true)]
|
[Timeout(BaseTimeoutMilliseconds, CooperativeCancellation = true)]
|
||||||
public async Task Video_Cancel_CancellationToken_Async_With_Timeout()
|
public async Task Video_Cancel_CancellationToken_Async_With_Timeout()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue