Subject: kern/35077: Audio subsystem may report invalid number of played samples (breaks xine)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <svs@ropnet.ru>
List: netbsd-bugs
Date: 11/18/2006 22:25:00
>Number:         35077
>Category:       kern
>Synopsis:       Audio subsystem may report invalid number of played samples (breaks xine)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 18 22:25:00 +0000 2006
>Originator:     Sergey Svishchev
>Release:        3.0.2_PATCH
>Organization:
>Environment:
>Description:
xine (and other apps using xine-engine for playback -- amaroK, for example) may not play streams which require format conversion.

>How-To-Repeat:
Configure xine to use `oss' output plugin and set `audio.oss_sync_method'  to `auto'.  Autodetection code will select `getoptr' a/v sync method in this case.

Start playing a monaural stream; sound is heard only for a second or less, then stops.  However, xine continues running until stream ends.

Workaround: use `sun' output plugin or change sync method to `softsync'.

Possible cause: auich(4) cannot play mono or 8-bit streams in hardware (only stereo and 16-bit), so kernel converts format on the fly and fails to properly update sample counter:

$ audioctl -w play=48000,1,16,slinear_le
play: -> 48000,1,16,slinear_le
play.rate: -> 48000
play.channels: -> 1
play.precision: -> 16
play.encoding: -> slinear_le

$ audioctl name play.samples play
name=ICH5 AC97
play.samples=0
play=48000,1,16,slinear_le

$ echo x > /dev/sound

$ audioctl name play.samples play
name=ICH5 AC97
play.samples=4294967294
play=48000,1,16,slinear_le

Note that 4294967294 == 0xfffffffe.

>Fix: