[FFmpeg-devel] [PATCH 1/2] dshow: fix return code when opening device
Stefano Sabatini
stefasab at gmail.com
Fri Dec 7 00:00:20 CET 2012
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.
--
FFmpeg = Formidable and Fiendish Mortal Puristic Elitist Guru
More information about the ffmpeg-devel
mailing list