RefCountedGLsync fence = RefCountedGLsync(GL_SYNC_GPU_COMMANDS_COMPLETE, /*flags=*/0);
check_error();
+ glFlush(); // Make the H.264 thread see the fence as soon as possible.
+ check_error();
{
unique_lock<mutex> lock(frame_queue_mutex);
RefCountedGLsync fence(GL_SYNC_GPU_COMMANDS_COMPLETE, /*flags=*/0);
check_error();
assert(fence.get() != nullptr);
+ glFlush(); // Make sure the main thread doesn't have to wait until we push out enough frames to make a new command buffer.
+ check_error();
if (field == 1) {
// Don't upload the second field as fast as we can; wait until