[FFmpeg-cvslog] dshow: fix return code when opening device
Ramiro Polla
git at videolan.org
Sat Dec 8 21:53:04 CET 2012
ffmpeg | branch: master | Ramiro Polla <ramiro.polla at gmail.com> | Thu Dec 6 02:32:47 2012 -0200| [f2c49da9ac486597a240cf62d23b8a85eb6fe6e9] | committer: Michael Niedermayer
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.
Reviewed-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f2c49da9ac486597a240cf62d23b8a85eb6fe6e9
---
libavdevice/dshow.c | 18 ++++++++----------
1 file 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);
More information about the ffmpeg-cvslog
mailing list