From b103a8e11335e8381f07959b4a627729cfd08e74 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 11 Aug 2015 19:02:01 +0200 Subject: DOCS/client_api_examples/sdl: don't load file before GL init Could lead to failure because it's essentially a race condition. --- DOCS/client_api_examples/sdl/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'DOCS') diff --git a/DOCS/client_api_examples/sdl/main.c b/DOCS/client_api_examples/sdl/main.c index 38d2cf57cc..8a489c06f0 100644 --- a/DOCS/client_api_examples/sdl/main.c +++ b/DOCS/client_api_examples/sdl/main.c @@ -72,10 +72,6 @@ int main(int argc, char *argv[]) if (mpv_set_option_string(mpv, "vo", "opengl-cb") < 0) die("failed to set VO"); - // Play this file. Note that this asynchronously starts playback. - const char *cmd[] = {"loadfile", argv[1], NULL}; - mpv_command(mpv, cmd); - // We use events for thread-safe notification of the SDL main loop. wakeup_on_mpv_redraw = SDL_RegisterEvents(1); wakeup_on_mpv_events = SDL_RegisterEvents(1); @@ -90,6 +86,10 @@ int main(int argc, char *argv[]) // users which run OpenGL on a different thread.) mpv_opengl_cb_set_update_callback(mpv_gl, on_mpv_redraw, NULL); + // Play this file. Note that this asynchronously starts playback. + const char *cmd[] = {"loadfile", argv[1], NULL}; + mpv_command(mpv, cmd); + while (1) { SDL_Event event; if (SDL_WaitEvent(&event) != 1) -- cgit v1.2.3