[FFmpeg-devel] [PATCH 1/2] dshow: fix return code when opening device

Michael Niedermayer michaelni at gmx.at
Sat Dec 8 21:05:43 CET 2012


On Fri, Dec 07, 2012 at 12:00:20AM +0100, Stefano Sabatini wrote:
> On date Thursday 2012-12-06 02:37:18 -0200, Ramiro Polla encoded:
> > On Tue, Dec 4, 2012 at 9:58 PM, Don Moir <donmoir at comcast.net> wrote:
> [...]
> > From f555f1b578c923c3d2fa1978e0a3fa7a1f0daea4 Mon Sep 17 00:00:00 2001
> > From: Ramiro Polla <ramiro.polla at gmail.com>
> > Date: Thu, 6 Dec 2012 02:32:47 -0200
> > Subject: [PATCH 1/3] dshow: fix return code when opening device
> > 
> > Successfully opening a device altered the ret variable, making the function
> > not cleanup properly and return an incorrect value for errors that happened
> > afterwards.
> > ---
> >  libavdevice/dshow.c |   18 ++++++++----------
> >  1 files changed, 8 insertions(+), 10 deletions(-)
> > 
> > diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
> > index ea01b2a..9485af6 100644
> > --- a/libavdevice/dshow.c
> > +++ b/libavdevice/dshow.c
> > @@ -929,20 +929,18 @@ static int dshow_read_header(AVFormatContext *avctx)
> >      }
> >  
> >      if (ctx->device_name[VideoDevice]) {
> > -        ret = dshow_open_device(avctx, devenum, VideoDevice);
> > -        if (ret < 0)
> > -            goto error;
> > -        ret = dshow_add_device(avctx, VideoDevice);
> > -        if (ret < 0)
> > +        if ((r = dshow_open_device(avctx, devenum, VideoDevice)) < 0 ||
> > +            (r = dshow_add_device(avctx, VideoDevice)) < 0) {
> > +            ret = r;
> >              goto error;
> > +        }
> >      }
> >      if (ctx->device_name[AudioDevice]) {
> > -        ret = dshow_open_device(avctx, devenum, AudioDevice);
> > -        if (ret < 0)
> > -            goto error;
> > -        ret = dshow_add_device(avctx, AudioDevice);
> > -        if (ret < 0)
> > +        if ((r = dshow_open_device(avctx, devenum, AudioDevice)) < 0 ||
> > +            (r = dshow_add_device(avctx, AudioDevice)) < 0) {
> > +            ret = r;
> >              goto error;
> > +        }
> >      }
> >  
> >      ctx->mutex = CreateMutex(NULL, 0, NULL);
> 
> LGTM, thanks.

applied

thanks

[...]
-- 
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121208/af637e41/attachment.asc>


More information about the ffmpeg-devel mailing list