exception handlers for video decoder threads

remotes/1695061714407202320/main
cosmonaut 2023-06-28 13:20:33 -07:00
parent 5ff7da927a
commit 1adb76d5c7
1 changed files with 12 additions and 4 deletions

View File

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