I made a change and let it run overnight and it seems to still be working. I'll let it run the rest of the day and see how it works. Basically, my GetVideoData() call is in a loop (as is your example in your C# demo) :
while (cancellationToken.IsCancellationRequested == false)
{
if (GetVideoData( ... ))
{
Marshal.Copy(...);
generateBitmap(...);
}
}
What I did was add a delay after ever capture before starting the next GetVideoData call:
while (cancellationToken.IsCancellationRequested == false)
{
if (GetVideoData( ... ))
{
Marshal.Copy(...);
generateBitmap(...);
async Task.Delay(25, cancellationToken);
}
}
This seems to have helped. Basically I am limited to 30 fps (at most) this way, but it was like I was calling the GetVideoData method too fast otherwise (my timing shows it was basically ever 3 or 4 milliseconds). For my application I am good with even getting at most 1fps (its for a time lapse video), so the added delay is not an issue.
I'll let you know if the issue still occurs and if so try your suggestions to get further data.
Roy