1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

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.
This commit is contained in:
Nicolas George 2023-07-12 14:57:39 +02:00
parent 886c1ffb5d
commit 02aeacbb5e

View File

@ -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); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
int ret; int ret;
/* At this point, opengl->glcontext implies opengl->glcontext */
if (opengl->glcontext)
SDL_GL_MakeCurrent(opengl->window, opengl->glcontext);
#if CONFIG_SDL2 #if CONFIG_SDL2
if (!opengl->no_window && (ret = opengl_sdl_process_events(h)) < 0) if (!opengl->no_window && (ret = opengl_sdl_process_events(h)) < 0)
goto fail; goto fail;