ffplay: more robust condition variable creation
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>
Mon, 5 Oct 2015 00:38:06 +0000 (20:38 -0400)
committerMarton Balint <cus@passwd.hu>
Mon, 5 Oct 2015 20:25:51 +0000 (22:25 +0200)
SDL_CreateCond can fail:
https://wiki.libsdl.org/SDL_CreateCond.
This patch makes creation more robust in one instance.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
ffplay.c

index 8c9f6b1..cf0640e 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -3168,7 +3168,10 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
         packet_queue_init(&is->subtitleq) < 0)
         goto fail;
 
-    is->continue_read_thread = SDL_CreateCond();
+    if (!(is->continue_read_thread = SDL_CreateCond())) {
+        av_log(NULL, AV_LOG_FATAL, "SDL_CreateCond(): %s\n", SDL_GetError());
+        goto fail;
+    }
 
     init_clock(&is->vidclk, &is->videoq.serial);
     init_clock(&is->audclk, &is->audioq.serial);