Fixing color format for opencv conversion

This commit is contained in:
Jonathan Thomas
2020-10-30 18:23:45 -05:00
parent b74b3ea841
commit df154c3844
3 changed files with 32 additions and 32 deletions

View File

@@ -93,43 +93,43 @@ namespace openshot
while (!threadShouldExit() && is_playing) {
// Cache frames before the other threads need them
// Cache frames up to the max frames. Reset to current position
// if cache gets too far away from display frame. Cache frames
// even when player is paused (i.e. speed 0).
while ((position - current_display_frame) < max_frames)
{
// Only cache up till the max_frames amount... then sleep
try
// Cache frames before the other threads need them
// Cache frames up to the max frames. Reset to current position
// if cache gets too far away from display frame. Cache frames
// even when player is paused (i.e. speed 0).
while (((position - current_display_frame) < max_frames) && is_playing)
{
if (reader) {
ZmqLogger::Instance()->AppendDebugMethod("VideoCacheThread::run (cache frame)", "position", position, "current_display_frame", current_display_frame, "max_frames", max_frames, "needed_frames", (position - current_display_frame));
// Only cache up till the max_frames amount... then sleep
try
{
if (reader) {
ZmqLogger::Instance()->AppendDebugMethod("VideoCacheThread::run (cache frame)", "position", position, "current_display_frame", current_display_frame, "max_frames", max_frames, "needed_frames", (position - current_display_frame));
// Force the frame to be generated
if (reader->GetCache()->GetSmallestFrame()) {
int64_t smallest_cached_frame = reader->GetCache()->GetSmallestFrame()->number;
if (smallest_cached_frame > current_display_frame) {
// Cache position has gotten too far away from current display frame.
// Reset the position to the current display frame.
position = current_display_frame;
// Force the frame to be generated
if (reader->GetCache()->GetSmallestFrame()) {
int64_t smallest_cached_frame = reader->GetCache()->GetSmallestFrame()->number;
if (smallest_cached_frame > current_display_frame) {
// Cache position has gotten too far away from current display frame.
// Reset the position to the current display frame.
position = current_display_frame;
}
}
reader->GetFrame(position);
}
reader->GetFrame(position);
}
catch (const OutOfBoundsFrame & e)
{
// Ignore out of bounds frame exceptions
}
}
catch (const OutOfBoundsFrame & e)
{
// Ignore out of bounds frame exceptions
// Increment frame number
position++;
}
// Increment frame number
position++;
}
// Sleep for 1 frame length
std::this_thread::sleep_for(frame_duration);
}
// Sleep for 1 frame length
std::this_thread::sleep_for(frame_duration);
}
return;
}