Skip to content

Commit

Permalink
Fix Decklink simulator extra frames
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeMartinez authored and g-maxime committed Jun 6, 2024
1 parent 74bec6c commit 89b10f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Source/Common/SimulatorWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct ctl
size_t Buffer_Offset;
size_t CurrentClusterPos = 0;
size_t NextClusterPos = 0;
bool FrameAvailable = false;

// MKV info
size_t Track_Pos = 0;
Expand Down Expand Up @@ -255,8 +256,12 @@ bool ctl::ParseBuffer(File& F)
F.Read(Buffer + Buffer_Size - Buffer_Offset, ToRead);
Buffer_Offset = 0;
}
}

return false; // New cluster
if (FrameAvailable)
{
FrameAvailable = false;
return false;
}
}

Expand All @@ -274,6 +279,9 @@ void ctl::Segment_Cluster()
{
IsList = true;

if (!CurrentClusterPos)
FrameAvailable = true; // First cluster detected, we will return now because we are in the init part

CurrentClusterPos = Buffer_Offset;
NextClusterPos = Levels[Level].Offset_End;
Track_Pos = (size_t)-1;
Expand All @@ -296,6 +304,7 @@ void ctl::Segment_Cluster_SimpleBlock()
{
Track_Pos++;
Buffer_Offset += 4;
FrameAvailable = true;

auto Size = Levels[Level].Offset_End - Buffer_Offset;

Expand Down

0 comments on commit 89b10f0

Please sign in to comment.