]> git.sesse.net Git - nageru/commitdiff
Fix an issue in the H264 encoder where a surface could be rendered to while it was...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 3 Apr 2016 10:55:06 +0000 (12:55 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 3 Apr 2016 10:55:06 +0000 (12:55 +0200)
h264encode.cpp

index 16fa811b450d8f1ad1ad2842ec21faba1b98af6d..6a402f45765e4932f1c0dcaf57208554d19f6969 100644 (file)
@@ -1603,7 +1603,6 @@ void H264EncoderImpl::storage_task_enqueue(storage_task task)
 {
        unique_lock<mutex> 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;
        }