notify rec_loop on draw_commit

This commit is contained in:
2019-11-09 14:58:15 +01:00
parent a00f78de80
commit 7b544522cf
3 changed files with 27 additions and 8 deletions

View File

@@ -792,10 +792,12 @@ void App::rec_loop()
rec_running = true;
while(rec_running)
{
auto t_now = std::chrono::high_resolution_clock::now();
float dt = std::chrono::duration<float>(t_now - canvas->m_canvas->m_disrty_stroke_time).count();
std::unique_lock<std::mutex> lock(rec_mutex);
rec_cv.wait(lock/*, [this] { return !(rec_frames.empty() && rec_running); }*/);
if (!rec_running)
break;
if (Canvas::I->m_encoder && dt > 0.75f && canvas->m_canvas->m_dirty_stroke)
if (Canvas::I->m_encoder)
{
canvas->m_canvas->m_dirty_stroke = false;
PBO equirect = Canvas::I->m_layers_merge.gen_equirect_pbo(
@@ -805,11 +807,9 @@ void App::rec_loop()
img.create(equirect.width, equirect.height, equirect.map());
Canvas::I->m_encoder->encode(img);
equirect.unmap();
LOG("frame encoded");
LOG("rec frame encoded");
update_rec_frames();
}
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}