mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
qml: activate the wrapped context when binding
Mitigates the following critical gst_gl_context_thread_add: assertion 'context->priv->active_thread == g_thread_self ()' failed
This commit is contained in:
parent
21ca4ac9d3
commit
aca25b521f
1 changed files with 9 additions and 4 deletions
|
@ -87,14 +87,16 @@ GstQSGTexture::bind ()
|
||||||
GstMemory *mem;
|
GstMemory *mem;
|
||||||
guint tex_id;
|
guint tex_id;
|
||||||
|
|
||||||
|
gst_gl_context_activate (this->qt_context_, TRUE);
|
||||||
|
|
||||||
if (!this->buffer_)
|
if (!this->buffer_)
|
||||||
return;
|
goto out;
|
||||||
if (GST_VIDEO_INFO_FORMAT (&this->v_info) == GST_VIDEO_FORMAT_UNKNOWN)
|
if (GST_VIDEO_INFO_FORMAT (&this->v_info) == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
this->mem_ = gst_buffer_peek_memory (this->buffer_, 0);
|
this->mem_ = gst_buffer_peek_memory (this->buffer_, 0);
|
||||||
if (!this->mem_)
|
if (!this->mem_)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
g_assert (this->qt_context_);
|
g_assert (this->qt_context_);
|
||||||
gl = this->qt_context_->gl_vtable;
|
gl = this->qt_context_->gl_vtable;
|
||||||
|
@ -103,7 +105,7 @@ GstQSGTexture::bind ()
|
||||||
if (!gst_video_frame_map (&this->v_frame, &this->v_info, this->buffer_,
|
if (!gst_video_frame_map (&this->v_frame, &this->v_info, this->buffer_,
|
||||||
(GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
|
(GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
mem = gst_buffer_peek_memory (this->buffer_, 0);
|
mem = gst_buffer_peek_memory (this->buffer_, 0);
|
||||||
|
@ -125,6 +127,9 @@ GstQSGTexture::bind ()
|
||||||
gl->BindTexture (GL_TEXTURE_2D, tex_id);
|
gl->BindTexture (GL_TEXTURE_2D, tex_id);
|
||||||
|
|
||||||
gst_video_frame_unmap (&this->v_frame);
|
gst_video_frame_unmap (&this->v_frame);
|
||||||
|
|
||||||
|
out:
|
||||||
|
gst_gl_context_activate (this->qt_context_, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* can be called from any thread */
|
/* can be called from any thread */
|
||||||
|
|
Loading…
Reference in a new issue