only check video exception on thread fault

pull/50/head
cosmonaut 2023-06-29 12:14:46 -07:00
parent bf3ad0c8b0
commit 36ddb03d8f
1 changed files with 5 additions and 8 deletions

View File

@ -174,7 +174,7 @@ namespace MoonWorks.Video
}
currentFrame = thisFrame;
Task.Run(CurrentStream.ReadNextFrame).ContinueWith(HandleTaskException);
Task.Run(CurrentStream.ReadNextFrame).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
}
if (CurrentStream.Ended)
@ -182,7 +182,7 @@ namespace MoonWorks.Video
timer.Stop();
timer.Reset();
Task.Run(CurrentStream.Reset).ContinueWith(HandleTaskException);
Task.Run(CurrentStream.Reset).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
if (Loop)
{
@ -260,8 +260,8 @@ namespace MoonWorks.Video
private void InitializeDav1dStream()
{
Task.Run(Video.StreamA.Reset).ContinueWith(HandleTaskException);
Task.Run(Video.StreamB.Reset).ContinueWith(HandleTaskException);
Task.Run(Video.StreamA.Reset).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
Task.Run(Video.StreamB.Reset).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
CurrentStream = Video.StreamA;
currentFrame = -1;
@ -269,10 +269,7 @@ namespace MoonWorks.Video
private static void HandleTaskException(Task task)
{
if (task.Exception != null)
{
throw task.Exception;
}
throw task.Exception;
}
protected virtual void Dispose(bool disposing)