diff mbox series

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

Message ID 1610638158-16500-1-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel] avformat/async: Use the correct return values | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Lance Wang Jan. 14, 2021, 3:29 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

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

Comments

Michael Niedermayer Jan. 15, 2021, 11:30 p.m. UTC | #1
On Thu, Jan 14, 2021 at 11:29:18PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@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);

the av_err2str() calls should probably be after AVERROR

thx

[...]
Lance Wang Jan. 16, 2021, 12:48 a.m. UTC | #2
On Sat, Jan 16, 2021 at 12:30:04AM +0100, Michael Niedermayer wrote:
> On Thu, Jan 14, 2021 at 11:29:18PM +0800, lance.lmwang@gmail.com wrote:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@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);
> 
> the av_err2str() calls should probably be after AVERROR

Yes, will move the AVERROR before av_log.

> 
> thx
> 
> [...]
> 
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> In fact, the RIAA has been known to suggest that students drop out
> of college or go to community college in order to be able to afford
> settlements. -- The RIAA



> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

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;
     }