if (prev_sync != NULL) {
glDeleteSync( prev_sync );
}
+ while (syncs_to_delete.count() > 0) {
+ GLsync sync = (GLsync) syncs_to_delete.pop_front();
+ glDeleteSync( sync );
+ }
}
GlslManager* GlslManager::get_instance()
texture->used = 0;
}
+void GlslManager::delete_sync(GLsync sync)
+{
+ // We do not know which thread we are called from, and we can only
+ // delete this if we are in one with a valid OpenGL context.
+ // Thus, store it for later deletion in render_frame_texture().
+ GlslManager* g = GlslManager::get_instance();
+ g->lock();
+ g->syncs_to_delete.push_back(sync);
+ g->unlock();
+}
+
glsl_pbo GlslManager::get_pbo(int size)
{
lock();
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
check_error();
+ lock();
+ while (syncs_to_delete.count() > 0) {
+ GLsync sync = (GLsync) syncs_to_delete.pop_front();
+ glDeleteSync( sync );
+ }
+ unlock();
+
// Make sure we never have more than one frame pending at any time.
// This ensures we do not swamp the GPU with so much work
// that we cannot actually display the frames we generate.
mlt_frame_set_image( frame, *image, 0, NULL );
mlt_properties_set_data( MLT_FRAME_PROPERTIES(frame), "movit.convert.texture", texture, 0,
(mlt_destructor) GlslManager::release_texture, NULL );
- mlt_properties_set_data( MLT_FRAME_PROPERTIES(frame), "movit.convert.fence", sync, 0, NULL, NULL );
+ mlt_properties_set_data( MLT_FRAME_PROPERTIES(frame), "movit.convert.fence", sync, 0,
+ (mlt_destructor) GlslManager::delete_sync, NULL );
return 0;
}