From: Steinar H. Gunderson Date: Sun, 3 Apr 2016 10:55:06 +0000 (+0200) Subject: Fix an issue in the H264 encoder where a surface could be rendered to while it was... X-Git-Tag: 1.2.0~19 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=315ba32cfb57f30840a019fe4952be1cf95e532b;p=nageru Fix an issue in the H264 encoder where a surface could be rendered to while it was still encoding the previous frame. --- diff --git a/h264encode.cpp b/h264encode.cpp index 16fa811..6a402f4 100644 --- a/h264encode.cpp +++ b/h264encode.cpp @@ -1603,7 +1603,6 @@ void H264EncoderImpl::storage_task_enqueue(storage_task task) { unique_lock lock(storage_task_queue_mutex); storage_task_queue.push(move(task)); - srcsurface_status[task.display_order % SURFACE_NUM] = SRC_SURFACE_IN_ENCODING; storage_task_queue_changed.notify_all(); } @@ -1732,6 +1731,7 @@ bool H264EncoderImpl::begin_frame(GLuint *y_tex, GLuint *cbcr_tex) current_storage_frame % SURFACE_NUM, current_storage_frame); } storage_task_queue_changed.wait(lock, [this]{ return storage_thread_should_quit || (srcsurface_status[current_storage_frame % SURFACE_NUM] == SRC_SURFACE_FREE); }); + srcsurface_status[current_storage_frame % SURFACE_NUM] = SRC_SURFACE_IN_ENCODING; if (storage_thread_should_quit) return false; }