Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2024 16:48:57 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 6158fa24aca6 - stable/14 - sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are disabled
Message-ID:  <202407101648.46AGmvbs034594@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=6158fa24aca661221defbf5738546ba68697cac8

commit 6158fa24aca661221defbf5738546ba68697cac8
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-07-06 18:22:08 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-07-10 16:48:12 +0000

    sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are disabled
    
    Currently, we are skipping physical channels when servicing
    SNDCTL_AUDIOINFO, and VCHANs when servicing SNDCTL_AUDIOINFO_EX.
    However, if we call SNDCTL_AUDIOINFO with VCHANs disabled, we'll
    eventually skip all channels, resulting in some of oss_audioinfo's
    fields containing wrong information (e.g min/max_channels).
    
    Fix this by adding an exception to SNDCTL_AUDIOINFO not to skip physical
    channels when VCHANs are disabled.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      2 days
    Reviewed by:    dev_submerge.ch, emaste
    Differential Revision:  https://reviews.freebsd.org/D45722
    
    (cherry picked from commit f30af1f037a68947edbabebc7ab495cd1b7a4ec8)
---
 sys/dev/sound/pcm/dsp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 0eb41faaae45..6ac85635b080 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -2159,9 +2159,13 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai, bool ex)
 		/*
 		 * Skip physical channels if we are servicing SNDCTL_AUDIOINFO,
 		 * or VCHANs if we are servicing SNDCTL_AUDIOINFO_EX.
+		 *
+		 * For SNDCTL_AUDIOINFO do not skip the physical channels if
+		 * there are no VCHANs.
 		 */
 		if ((ex && (ch->flags & CHN_F_VIRTUAL) != 0) ||
-		    (!ex && (ch->flags & CHN_F_VIRTUAL) == 0)) {
+		    ((!ex && (ch->flags & CHN_F_VIRTUAL) == 0) &&
+		    (d->pvchancount > 0 || d->rvchancount > 0))) {
 			CHN_UNLOCK(ch);
 			continue;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407101648.46AGmvbs034594>