From 61698e0ca17f152a5e60d1252b4534411096fc2a Mon Sep 17 00:00:00 2001 From: Alexander Kabaev Date: Tue, 23 Jul 2002 14:50:51 +0000 Subject: [PATCH] Fix the sound driver vchan support to work when hw.snd.maxautovchans has been specified through /boot/loader.conf as opposed to setting it in /etc/sysctl.conf. Only PCMDIR_PLAY channel can be used as a parent of virtual channel. Do not initialize a new vchan for a given physical channel if other physical channel already has one created. PR: 31597 Approved by: obrien (mentor) --- sys/dev/sound/pcm/sound.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index ddf466b6f977..3f346f32f0e5 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -504,7 +504,8 @@ pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo) return err; } - if (snd_maxautovchans > 0 && (d->flags & SD_F_AUTOVCHAN)) { + if (snd_maxautovchans > 0 && (d->flags & SD_F_AUTOVCHAN) && + ch->direction == PCMDIR_PLAY && d->vchancount == 0) { ch->flags |= CHN_F_BUSY; err = vchan_create(ch); if (err) {