forked from MoonsideGames/MoonWorks
exception handlers for video decoder threads
parent
5ff7da927a
commit
1adb76d5c7
|
@ -174,7 +174,7 @@ namespace MoonWorks.Video
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFrame = thisFrame;
|
currentFrame = thisFrame;
|
||||||
Task.Run(CurrentStream.ReadNextFrame);
|
Task.Run(CurrentStream.ReadNextFrame).ContinueWith(HandleTaskException);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurrentStream.Ended)
|
if (CurrentStream.Ended)
|
||||||
|
@ -182,7 +182,7 @@ namespace MoonWorks.Video
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
timer.Reset();
|
timer.Reset();
|
||||||
|
|
||||||
Task.Run(CurrentStream.Reset);
|
Task.Run(CurrentStream.Reset).ContinueWith(HandleTaskException);
|
||||||
|
|
||||||
if (Loop)
|
if (Loop)
|
||||||
{
|
{
|
||||||
|
@ -260,13 +260,21 @@ namespace MoonWorks.Video
|
||||||
|
|
||||||
private void InitializeDav1dStream()
|
private void InitializeDav1dStream()
|
||||||
{
|
{
|
||||||
Task.Run(Video.StreamA.Reset);
|
Task.Run(Video.StreamA.Reset).ContinueWith(HandleTaskException);
|
||||||
Task.Run(Video.StreamB.Reset);
|
Task.Run(Video.StreamB.Reset).ContinueWith(HandleTaskException);
|
||||||
|
|
||||||
CurrentStream = Video.StreamA;
|
CurrentStream = Video.StreamA;
|
||||||
currentFrame = -1;
|
currentFrame = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void HandleTaskException(Task task)
|
||||||
|
{
|
||||||
|
if (task.Exception != null)
|
||||||
|
{
|
||||||
|
Logger.LogError(task.Exception.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
|
|
Loading…
Reference in New Issue