[FFmpeg-devel] [PATCH] avformat/async: Use the correct return values

lance.lmwang at gmail.com lance.lmwang at gmail.com
Thu Jan 14 17:29:18 EET 2021


From: Limin Wang <lance.lmwang at gmail.com>

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
---
 libavformat/async.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/async.c b/libavformat/async.c
index a0bdfa2..801b20e 100644
--- a/libavformat/async.c
+++ b/libavformat/async.c
@@ -263,24 +263,28 @@ static int async_open(URLContext *h, const char *arg, int flags, AVDictionary **
     ret = pthread_mutex_init(&c->mutex, NULL);
     if (ret != 0) {
         av_log(h, AV_LOG_ERROR, "pthread_mutex_init failed : %s\n", av_err2str(ret));
+        ret = AVERROR(ret);
         goto mutex_fail;
     }
 
     ret = pthread_cond_init(&c->cond_wakeup_main, NULL);
     if (ret != 0) {
         av_log(h, AV_LOG_ERROR, "pthread_cond_init failed : %s\n", av_err2str(ret));
+        ret = AVERROR(ret);
         goto cond_wakeup_main_fail;
     }
 
     ret = pthread_cond_init(&c->cond_wakeup_background, NULL);
     if (ret != 0) {
         av_log(h, AV_LOG_ERROR, "pthread_cond_init failed : %s\n", av_err2str(ret));
+        ret = AVERROR(ret);
         goto cond_wakeup_background_fail;
     }
 
     ret = pthread_create(&c->async_buffer_thread, NULL, async_buffer_task, h);
     if (ret) {
         av_log(h, AV_LOG_ERROR, "pthread_create failed : %s\n", av_err2str(ret));
+        ret = AVERROR(ret);
         goto thread_fail;
     }
 
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list