aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiederick Niehorster <dcnieho@gmail.com>2022-03-25 15:10:20 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-04 00:05:36 +0200
commit30107735083f6bbc08a10fc0441b3cf3213e0827 (patch)
tree30f515d751a2e65cbe2e5f57e64f95dcdfecd701
parent482d51884c06a15a2712eb7629fbdd21720f61e9 (diff)
downloadffmpeg-30107735083f6bbc08a10fc0441b3cf3213e0827.tar.gz
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> (cherry picked from commit f125c504d8fece6420bb97767f9e72414c26312a) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavdevice/dshow.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c
index 3a16f3720f..dc20d76b63 100644
--- a/libavdevice/dshow.c
+++ b/libavdevice/dshow.c
@@ -1002,23 +1002,12 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
);
continue;
}
- if (requested_sample_rate) {
- if (requested_sample_rate > acaps->MaximumSampleFrequency ||
- requested_sample_rate < acaps->MinimumSampleFrequency)
- goto next;
- fx->nSamplesPerSec = requested_sample_rate;
- }
- 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;
+ if (
+ (ctx->sample_rate && ctx->sample_rate != fx->nSamplesPerSec) ||
+ (ctx->sample_size && ctx->sample_size != fx->wBitsPerSample) ||
+ (ctx->channels && ctx->channels != fx->nChannels )
+ ) {
+ goto next;
}
}