Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 May 2020 01:42:48 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 246206] dev/sound: SNDCTL_SYSINFO does not report PCM_CAP_VIRTUAL
Message-ID:  <bug-246206-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D246206

            Bug ID: 246206
           Summary: dev/sound: SNDCTL_SYSINFO does not report
                    PCM_CAP_VIRTUAL
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: kevinz5000@gmail.com
 Attachment #214136 text/plain
         mime type:

Created attachment 214136
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D214136&action=
=3Dedit
Demonstration of issue

In sys/soundcard.h, PCM_CAP_VIRTUAL is documented as "Virtual device":

#       define PCM_CAP_VIRTUAL          0x00040000      /* Virtual device */

When SNDCTL_AUDIOINFO is called on /dev/mixer, no virtual devices have have
PCM_CAP_VIRTUAL set. This means, apart from being smart, consumers of the O=
SS4
API can't tell virtual devices from real devices. This leads to a confusing
choice in, say, audio programs that allow selection of vchans.

A short example program that demonstrates the issue is attached. Example ou=
tput
on my computer is:

$ clang vpctest.c -o vpctest
$ ./vpctest
dev /dev/dsp0.p0        virtual 0
dev /dev/dsp0.vp0       virtual 0
dev /dev/dsp0.vp1       virtual 0
dev /dev/dsp0.r0        virtual 0
dev /dev/dsp0.vr0       virtual 0
dev /dev/dsp0.vr1       virtual 0

The vp* and vr* devices are virtual, but PCM_CAP_VIRTUAL is not set.

The root cause of this issue appears to be in dev/sound/pcm/dsp.c:

        ai->caps =3D PCM_CAP_REALTIME | PCM_CAP_MMAP | PCM_CAP_TRIGGER |
CHANNEL_GETCAPS(ch)
                ((ch->direction =3D=3D PCMDIR_PLAY) ? PCM_CAP_OUTPUT :
PCM_CAP_INPUT);

Most notably, PCM_CAP_VIRTUAL is never set. Further, the channel capabiliti=
es
queried earlier:

caps =3D chn_getcaps(ch);

Do not appear to be used, either.

I suggest that virtual channels return PCM_CAP_VIRTUAL in vchan_getcaps()
(dev/sound/pcm/vchan.c), and then channel capabilities get OR'ed into ai->c=
aps.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



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