diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index ea01b2a30f417e9a4807d5795591c9e382af747b..9485af6586ae1ea74b52f9e248f11fbf9c8e1956 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);