mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-23 04:24:35 +02:00
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@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
129d737150
commit
f2c49da9ac
@ -929,21 +929,19 @@ static int dshow_read_header(AVFormatContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->device_name[VideoDevice]) {
|
if (ctx->device_name[VideoDevice]) {
|
||||||
ret = dshow_open_device(avctx, devenum, VideoDevice);
|
if ((r = dshow_open_device(avctx, devenum, VideoDevice)) < 0 ||
|
||||||
if (ret < 0)
|
(r = dshow_add_device(avctx, VideoDevice)) < 0) {
|
||||||
goto error;
|
ret = r;
|
||||||
ret = dshow_add_device(avctx, VideoDevice);
|
|
||||||
if (ret < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (ctx->device_name[AudioDevice]) {
|
if (ctx->device_name[AudioDevice]) {
|
||||||
ret = dshow_open_device(avctx, devenum, AudioDevice);
|
if ((r = dshow_open_device(avctx, devenum, AudioDevice)) < 0 ||
|
||||||
if (ret < 0)
|
(r = dshow_add_device(avctx, AudioDevice)) < 0) {
|
||||||
goto error;
|
ret = r;
|
||||||
ret = dshow_add_device(avctx, AudioDevice);
|
|
||||||
if (ret < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ctx->mutex = CreateMutex(NULL, 0, NULL);
|
ctx->mutex = CreateMutex(NULL, 0, NULL);
|
||||||
if (!ctx->mutex) {
|
if (!ctx->mutex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user