The branch main has been updated by christos:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=86585210fd5657542884b22eb52b21e960b7be6c

commit 86585210fd5657542884b22eb52b21e960b7be6c
Author:     Christos Margiolis <[email protected]>
AuthorDate: 2024-07-06 18:23:04 +0000
Commit:     Christos Margiolis <[email protected]>
CommitDate: 2024-07-06 18:23:04 +0000

    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
---
 sys/dev/sound/pcm/dsp.c | 20 ++++++++++++++++----
 1 file 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;

Reply via email to