[FFmpeg-devel] [PATCH] ffplay: more robust condition variable creation

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sun Oct 4 18:23:08 CEST 2015


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 at gmail.com>
---
 ffplay.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffplay.c b/ffplay.c
index 39a1cbe..03befdc 100644
--- 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(is, 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);
-- 
2.6.0



More information about the ffmpeg-devel mailing list