From d3c85b4d19f57c99d503ce9abf68f5d963dd454c Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Wed, 21 Dec 2022 02:32:41 +1100 Subject: [PATCH] qmlglsrc: Unmap buffer before adding sync meta Adding a sync meta to a GstBuffer requires that it be writable. Mapping the buffer with the video frame API holds an extra ref on the buffer, so unmap before trying to modify it. Part-of: --- subprojects/gst-plugins-good/ext/qt/qtwindow.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/qt/qtwindow.cc b/subprojects/gst-plugins-good/ext/qt/qtwindow.cc index f67f286698..ec8f85d89a 100644 --- a/subprojects/gst-plugins-good/ext/qt/qtwindow.cc +++ b/subprojects/gst-plugins-good/ext/qt/qtwindow.cc @@ -236,6 +236,9 @@ QtGLWindow::afterRendering() gl->CopyTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, width, height, 0); } + gl->BindFramebuffer (GL_FRAMEBUFFER, 0); + gst_video_frame_unmap (&gl_frame); + if (this->priv->context) { sync_meta = gst_buffer_get_gl_sync_meta (this->priv->buffer); if (!sync_meta) { @@ -246,16 +249,19 @@ QtGLWindow::afterRendering() GST_DEBUG ("rendering finished"); -errors: - gl->BindFramebuffer (GL_FRAMEBUFFER, 0); - gst_video_frame_unmap (&gl_frame); - +done: gst_gl_context_activate (context, FALSE); this->priv->result = ret; this->priv->updated = TRUE; g_cond_signal (&this->priv->update_cond); g_mutex_unlock (&this->priv->lock); + return; + +errors: + gl->BindFramebuffer (GL_FRAMEBUFFER, 0); + gst_video_frame_unmap (&gl_frame); + goto done; } void