gl: Propagation of GL display/context not working correctly if using GL elements outside and inside playsink
The following pipeline does not work with 1.22 / git main (and deadlocks for other reasons with 1.20):
$ gst-launch-1.0 videotestsrc ! glvideomixer ! sink.video_sink playsink name=sink video-sink="glimagesink"
What happens here is that outside and inside playsink a different GL display and context are used, and both contexts are not sharing with each other.
This then causes no window to show up, rendering to fail and for each frame errors as follows to be printed
0:00:00.103075402 3920565 0x7f0664002180 ERROR gldebug gstgldebug.c:306:_gst_gl_debug_callback:<glcontextegl1> high: GL error from API id:2, GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer)
0:00:00.103086683 3920565 0x7f0664002180 ERROR gldebug gstgldebug.c:306:_gst_gl_debug_callback:<glcontextegl1> high: GL error from API id:2, GL_INVALID_FRAMEBUFFER_OPERATION in glDrawElements
0:00:00.136571386 3920565 0x7f0664002180 ERROR gldebug gstgldebug.c:306:_gst_gl_debug_callback:<glcontextegl1> high: GL error from API id:2, GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer)
0:00:00.136615900 3920565 0x7f0664002180 ERROR gldebug gstgldebug.c:306:_gst_gl_debug_callback:<glcontextegl1> high: GL error from API id:2, GL_INVALID_FRAMEBUFFER_OPERATION in glDrawElements
0:00:00.169940583 3920565 0x7f0664002180 ERROR gldebug gstgldebug.c:306:_gst_gl_debug_callback:<glcontextegl1> high: GL error from API id:2, GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer)
Original issue description below
I have a problem with the gtk4paintablesink and OpenGL playback, when using a video-stream-combiner with gst_play. I used a modified Glide to produce this problem. You can find it here: https://github.com/marcbull/glide/tree/video-compositor
The repository contains two Dot files of the pipeline and logs for both cases.
Without a video-stream-combiner property set, the gtk4paintablesink shows the expected video frames. If I assign a glvideomixer to the video-stream-combiner property, the view stays black, but you can hear audio playback.
I experienced this on Linux and on macOS.
Glide was started like this:
GST_DEBUG_DUMP_DOT_DIR=/tmp/gst GST_DEBUG="gtk4paintablesink:7" cargo r -- -i -c SampleVideo_1280x720_1mb.mp4 &| tee /tmp/glide.log
I added an command line argument to enable the use of the glvideomixer:
-c, --compositor Use glvideomixer as video-stream-combiner in the pipeline
The issue also occurs with the playbin3 element. It can be enabled with the following command line argument:
-p, --playbin3 Use playbin3 instead of playbin2
Is this a problem in the gtk4paintablesink or another component?
Thanks for your help.