aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pcm/dsp.c
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2024-07-06 18:23:04 +0000
committerChristos Margiolis <christos@FreeBSD.org>2024-07-06 18:23:04 +0000
commit86585210fd5657542884b22eb52b21e960b7be6c (patch)
tree38fefec821042a78e058b0b42055d2b5238538d5 /sys/dev/sound/pcm/dsp.c
parent2d6fc24673ccc97020c94094f97ee015f1db9702 (diff)
downloadsrc-86585210fd5657542884b22eb52b21e960b7be6c.tar.gz
src-86585210fd5657542884b22eb52b21e960b7be6c.zip
sound: Fix min/max rate for SNDCTL_AUDIOINFO and SNDCTL_ENGINEINFO
Since we allow feeding of any rate within the [feeder_rate_min, feeder_rate_max] range, report this as the min/max rate as well. Only exceptions are when we the device is opened in exclusive or bitperfect mode. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45862
Diffstat (limited to 'sys/dev/sound/pcm/dsp.c')
-rw-r--r--sys/dev/sound/pcm/dsp.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 27c89c3231b7..0689dfedb9c2 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -2170,8 +2170,13 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai, bool ex)
else
ai->iformats |= fmts;
- ai->min_rate = min(ai->min_rate, caps->minspeed);
- ai->max_rate = max(ai->max_rate, caps->maxspeed);
+ if (ex || (pcm_getflags(d->dev) & SD_F_BITPERFECT)) {
+ ai->min_rate = min(ai->min_rate, caps->minspeed);
+ ai->max_rate = max(ai->max_rate, caps->maxspeed);
+ } else {
+ ai->min_rate = min(ai->min_rate, feeder_rate_min);
+ ai->max_rate = max(ai->max_rate, feeder_rate_max);
+ }
ai->min_channels = min(ai->min_channels, minch);
ai->max_channels = max(ai->max_channels, maxch);
@@ -2369,8 +2374,15 @@ dsp_oss_engineinfo(struct cdev *i_dev, oss_audioinfo *ai)
* @todo @c handle - haven't decided how to generate
* this yet; bus, vendor, device IDs?
*/
- ai->min_rate = caps->minspeed;
- ai->max_rate = caps->maxspeed;
+
+ if ((ch->flags & CHN_F_EXCLUSIVE) ||
+ (pcm_getflags(d->dev) & SD_F_BITPERFECT)) {
+ ai->min_rate = caps->minspeed;
+ ai->max_rate = caps->maxspeed;
+ } else {
+ ai->min_rate = feeder_rate_min;
+ ai->max_rate = feeder_rate_max;
+ }
ai->min_channels = minch;
ai->max_channels = maxch;