forked from MoonsideGames/MoonWorks
only check video exception on thread fault
parent
bf3ad0c8b0
commit
36ddb03d8f
|
@ -174,7 +174,7 @@ namespace MoonWorks.Video
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFrame = thisFrame;
|
currentFrame = thisFrame;
|
||||||
Task.Run(CurrentStream.ReadNextFrame).ContinueWith(HandleTaskException);
|
Task.Run(CurrentStream.ReadNextFrame).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
}
|
}
|
||||||
|
|
||||||
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).ContinueWith(HandleTaskException);
|
Task.Run(CurrentStream.Reset).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
|
|
||||||
if (Loop)
|
if (Loop)
|
||||||
{
|
{
|
||||||
|
@ -260,20 +260,17 @@ namespace MoonWorks.Video
|
||||||
|
|
||||||
private void InitializeDav1dStream()
|
private void InitializeDav1dStream()
|
||||||
{
|
{
|
||||||
Task.Run(Video.StreamA.Reset).ContinueWith(HandleTaskException);
|
Task.Run(Video.StreamA.Reset).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
Task.Run(Video.StreamB.Reset).ContinueWith(HandleTaskException);
|
Task.Run(Video.StreamB.Reset).ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
|
|
||||||
CurrentStream = Video.StreamA;
|
CurrentStream = Video.StreamA;
|
||||||
currentFrame = -1;
|
currentFrame = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleTaskException(Task task)
|
private static void HandleTaskException(Task task)
|
||||||
{
|
|
||||||
if (task.Exception != null)
|
|
||||||
{
|
{
|
||||||
throw task.Exception;
|
throw task.Exception;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue