Bug 28084

Summary: Two possible PCM problems and patch
Product: Base System Reporter: ak03 <ak03>
Component: kernAssignee: cg
Status: Closed FIXED    
Severity: Affects Only Me CC: cg
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description ak03 2001-06-11 23:40:01 UTC
	There are three possible promlems in the -CURRENT PCM code

	a) pcm_chn_add deletes channel passed to it as a parameter, even 
	   though all pcm_chn_add callers call pcm_chn_destroy themselves
	   when pcm_chn_add fails. pcm_chn_destroy then attempts to delete
	   pcm_channel struct which already has been deleted

	b) dynamic sysctl handler for the number of virtual channels does 
	   not resize d->arec and d->aplay arrays. The code like d->aplay[chan]
	   is used all over the place in PCM, and in presence of dynamically
	   allocated vchannels channel number can be bigger than d->maxchan
	   which is statically computed in pcm_register based of the number
	   of actual hardware channels.

	c) When creating additional vchannels, the code sets CHN_F_BUSY 
	   flag _before_ calling vchan_create and fails to clean that 
	   flag when vchan_create returns error and no other vchannels weres
           created, thus leaving the parent channel permanently busy.

Fix: Attached patch patch tries to address the above problems. With patch
	applied I was able to run my sbc16 sound card with 4 vchannels all
	playing simultaneously :)
How-To-Repeat: 	N/A
Comment 1 dwmalone freebsd_committer freebsd_triage 2001-06-12 08:49:18 UTC
Responsible Changed
From-To: freebsd-bugs->cg

Cameron is the boss of sound. 

Cameron - is there any way we can assign sound PRs to all the sound guys 
instead of you in particular?
Comment 2 greid freebsd_committer freebsd_triage 2001-07-13 02:21:34 UTC
State Changed
From-To: open->closed

Committed (by cg), thanks!