avdevice/dshow: fix regression

a1c4929f accidentally undid part of d9a9b4c8, so the bug in ticket #9420
resurfaced. Fixing again.

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Diederick Niehorster 2022-03-25 15:10:20 +01:00 committed by Michael Niedermayer
parent 7c35aa60a5
commit f125c504d8
1 changed files with 6 additions and 17 deletions

View File

@ -1002,23 +1002,12 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
); );
continue; continue;
} }
if (requested_sample_rate) { if (
if (requested_sample_rate > acaps->MaximumSampleFrequency || (ctx->sample_rate && ctx->sample_rate != fx->nSamplesPerSec) ||
requested_sample_rate < acaps->MinimumSampleFrequency) (ctx->sample_size && ctx->sample_size != fx->wBitsPerSample) ||
goto next; (ctx->channels && ctx->channels != fx->nChannels )
fx->nSamplesPerSec = requested_sample_rate; ) {
} goto next;
if (requested_sample_size) {
if (requested_sample_size > acaps->MaximumBitsPerSample ||
requested_sample_size < acaps->MinimumBitsPerSample)
goto next;
fx->wBitsPerSample = requested_sample_size;
}
if (requested_channels) {
if (requested_channels > acaps->MaximumChannels ||
requested_channels < acaps->MinimumChannels)
goto next;
fx->nChannels = requested_channels;
} }
} }