summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2023-07-12 14:57:39 +0200
committerNicolas George <george@nsup.org>2023-07-12 15:06:15 +0200
commit02aeacbb5e77f1c760031dc6426a46671c6d220a (patch)
tree68f1352fbde2bbfd1467ac82d518823d60e2232e /libavdevice
parent886c1ffb5da83a239df292800d16d399bc5ab0a7 (diff)
lavd/opengl: select the GL context before drawing
Since “2d924b3a63 fftools/ffmpeg: move each muxer to a separate thread”, opengl_write_packet() is called from a different thread than opengl_write_header() and would nothing for lack of a selected context.
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/opengl_enc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavdevice/opengl_enc.c b/libavdevice/opengl_enc.c
index 88c413ee63..8d059343fb 100644
--- a/libavdevice/opengl_enc.c
+++ b/libavdevice/opengl_enc.c
@@ -1200,6 +1200,10 @@ static int opengl_draw(AVFormatContext *h, void *input, int repaint, int is_pkt)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int ret;
+ /* At this point, opengl->glcontext implies opengl->glcontext */
+ if (opengl->glcontext)
+ SDL_GL_MakeCurrent(opengl->window, opengl->glcontext);
+
#if CONFIG_SDL2
if (!opengl->no_window && (ret = opengl_sdl_process_events(h)) < 0)
goto fail;