potential fix for render before decode finish
parent
ee8331a96b
commit
1b40b5e7d3
|
@ -19,8 +19,8 @@ namespace MoonWorks.Video
|
||||||
private VideoAV1Stream CurrentStream = null;
|
private VideoAV1Stream CurrentStream = null;
|
||||||
|
|
||||||
private Task ReadNextFrameTask;
|
private Task ReadNextFrameTask;
|
||||||
private Task ResetStreamATask;
|
private Task ResetTask;
|
||||||
private Task ResetStreamBTask;
|
private Task ResetSecondaryStreamTask;
|
||||||
|
|
||||||
private Texture yTexture = null;
|
private Texture yTexture = null;
|
||||||
private Texture uTexture = null;
|
private Texture uTexture = null;
|
||||||
|
@ -165,8 +165,8 @@ namespace MoonWorks.Video
|
||||||
public void Unload()
|
public void Unload()
|
||||||
{
|
{
|
||||||
Stop();
|
Stop();
|
||||||
ResetStreamATask?.Wait();
|
ResetTask?.Wait();
|
||||||
ResetStreamBTask?.Wait();
|
ResetSecondaryStreamTask?.Wait();
|
||||||
Video = null;
|
Video = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,17 +202,8 @@ namespace MoonWorks.Video
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
timer.Reset();
|
timer.Reset();
|
||||||
|
|
||||||
var task = Task.Run(CurrentStream.Reset);
|
ResetTask = Task.Run(CurrentStream.Reset);
|
||||||
task.ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
ResetTask.ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
|
|
||||||
if (CurrentStream == Video.StreamA)
|
|
||||||
{
|
|
||||||
ResetStreamATask = task;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ResetStreamBTask = task;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Loop)
|
if (Loop)
|
||||||
{
|
{
|
||||||
|
@ -232,6 +223,8 @@ namespace MoonWorks.Video
|
||||||
{
|
{
|
||||||
lock (CurrentStream)
|
lock (CurrentStream)
|
||||||
{
|
{
|
||||||
|
ResetTask?.Wait();
|
||||||
|
|
||||||
var commandBuffer = Device.AcquireCommandBuffer();
|
var commandBuffer = Device.AcquireCommandBuffer();
|
||||||
|
|
||||||
var ySpan = new Span<byte>((void*) CurrentStream.yDataHandle, (int) CurrentStream.yDataLength);
|
var ySpan = new Span<byte>((void*) CurrentStream.yDataHandle, (int) CurrentStream.yDataLength);
|
||||||
|
@ -331,10 +324,10 @@ namespace MoonWorks.Video
|
||||||
{
|
{
|
||||||
ReadNextFrameTask?.Wait();
|
ReadNextFrameTask?.Wait();
|
||||||
|
|
||||||
ResetStreamATask = Task.Run(Video.StreamA.Reset);
|
ResetTask = Task.Run(Video.StreamA.Reset);
|
||||||
ResetStreamATask.ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
ResetTask.ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
ResetStreamBTask = Task.Run(Video.StreamB.Reset);
|
ResetSecondaryStreamTask = Task.Run(Video.StreamB.Reset);
|
||||||
ResetStreamBTask.ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
ResetSecondaryStreamTask.ContinueWith(HandleTaskException, TaskContinuationOptions.OnlyOnFaulted);
|
||||||
|
|
||||||
CurrentStream = Video.StreamA;
|
CurrentStream = Video.StreamA;
|
||||||
currentFrame = -1;
|
currentFrame = -1;
|
||||||
|
|
Loading…
Reference in New Issue