Minor adjustment

Former-commit-id: 82fc6e92c9
This commit is contained in:
Malte Rosenbjerg 2020-05-13 00:11:53 +02:00
parent dd785a8203
commit ff5b9e3b42
2 changed files with 8 additions and 8 deletions

View file

@ -643,7 +643,7 @@ public async Task Video_Cancel_Async()
{
await using var resStream = new MemoryStream();
var reader = new StreamPipeDataReader(resStream);
var writer = new RawVideoPipeDataWriter(BitmapSource.CreateBitmaps(256, System.Drawing.Imaging.PixelFormat.Format24bppRgb, 128, 128));
var writer = new RawVideoPipeDataWriter(BitmapSource.CreateBitmaps(512, System.Drawing.Imaging.PixelFormat.Format24bppRgb, 128, 128));
var task = FFMpegArguments
.FromPipe(writer)
@ -653,7 +653,7 @@ public async Task Video_Cancel_Async()
.CancellableThrough(out var cancel)
.ProcessAsynchronously(false);
await Task.Delay(100);
await Task.Delay(300);
cancel();
var result = await task;

View file

@ -26,7 +26,7 @@ internal FFMpegArgumentProcessor(FFMpegArguments ffMpegArguments)
public string Arguments => _ffMpegArguments.Text;
private event EventHandler _cancelEvent;
private event EventHandler CancelEvent = null!;
public FFMpegArgumentProcessor NotifyOnProgress(Action<double> onPercentageProgress, TimeSpan totalTimeSpan)
{
@ -41,7 +41,7 @@ public FFMpegArgumentProcessor NotifyOnProgress(Action<TimeSpan> onTimeProgress)
}
public FFMpegArgumentProcessor CancellableThrough(out Action cancel)
{
cancel = () => _cancelEvent?.Invoke(this, EventArgs.Empty);
cancel = () => CancelEvent?.Invoke(this, EventArgs.Empty);
return this;
}
public bool ProcessSynchronously(bool throwOnError = true)
@ -53,7 +53,7 @@ void OnCancelEvent(object sender, EventArgs args)
instance?.SendInput("q");
cancellationTokenSource.Cancel();
}
_cancelEvent += OnCancelEvent;
CancelEvent += OnCancelEvent;
_ffMpegArguments.Pre();
try
@ -70,7 +70,7 @@ void OnCancelEvent(object sender, EventArgs args)
}
finally
{
_cancelEvent -= OnCancelEvent;
CancelEvent -= OnCancelEvent;
_ffMpegArguments.Post();
}
@ -92,7 +92,7 @@ void OnCancelEvent(object sender, EventArgs args)
instance?.SendInput("q");
cancellationTokenSource.Cancel();
}
_cancelEvent += OnCancelEvent;
CancelEvent += OnCancelEvent;
_ffMpegArguments.Pre();
try
@ -109,7 +109,7 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t =>
}
finally
{
_cancelEvent -= OnCancelEvent;
CancelEvent -= OnCancelEvent;
_ffMpegArguments.Post();
}