I was just about to do a post about this, but as it seems to be exactly the same problem as I have, I'll simply reply here instead.
I have the same type of sound card (HDA) as the original poster and I'm experiencing exactly the same symptoms as well. The card works with snd_hda(4) so I guess it's not broken hardware (snd_hda doesn't do spdifout and surround, thats why I want oss).
Here is the output from ossinfo (I've tried oss-v4.1test0-070717-src-cddl.tar.bz2 as well but with no luck).
- Code: Select all
Version info: OSS 4.0 (build 070707/200707311333/C^B (0x00040002)
Platform: FreeBSD/i386 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Tue Jul 31 00:51:41 CEST 2007 root@nexus:/usr/obj/usr/src/sys/NEXUS
Number of audio devices: 14
Number of audio engines: 14
Number of MIDI devices: 0
Number of mixer devices: 1
Device objects
0: hdaudio0 Intel HD Audio
1: vmix0 OSS transparent virtual support
MIDI devices (/dev/midi*)
Mixer devices (/dev/mixer*)
0: Intel HD Audio STAC9271D (Mixer 0 of device object 0)
Device file /dev/oss/hdaudio0/mix0, Legacy device /dev/mixer0
Priority: 10
Caps:
Device handle: OSS-PCI-mx01
Device priority: 10
Audio devices
/dev/oss/hdaudio0/pcm0 Intel HD Audio pcm1 output (device index 0)
Legacy device /dev/dsp0
Caps: TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 0/Intel HD Audio pcm1 output
Available for use
Engine 2: 10/Intel HD Audio pcm1 output (VMIX0)
Available for use
Engine 3: 11/Intel HD Audio pcm1 output (VMIX0)
Available for use
Engine 4: 12/Intel HD Audio pcm1 output (VMIX0)
Available for use
Engine 5: 13/Intel HD Audio pcm1 output (VMIX0)
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au01
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 8
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/pcm1 Intel HD Audio pcm2 output (device index 1)
Legacy device /dev/dsp1
Caps: TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 1/Intel HD Audio pcm2 output
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au02
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/pcm2 Intel HD Audio pcm3 output (device index 2)
Legacy device /dev/dsp2
Caps: TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 2/Intel HD Audio pcm3 output
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au03
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/pcm3 Intel HD Audio pcm4 output (device index 3)
Legacy device /dev/dsp3
Caps: TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 3/Intel HD Audio pcm4 output
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au04
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/pcm4 Intel HD Audio pcm5 output (device index 4)
Legacy device /dev/dsp4
Caps: TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 4/Intel HD Audio pcm5 output
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au05
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/spdout0 Intel HD Audio spdifout output (device index 5)
Legacy device /dev/dsp5
Caps: TRIGGER MMAP
Modes: OUTPUT
Out engine 1: 5/Intel HD Audio spdifout output
Available for use
Input formats (0x00001410):
AFMT_S16_LE - 16 bit signed little endian
AFMT_AC3 - AC3 (Dolby Digital) encoded audio
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001410):
AFMT_S16_LE - 16 bit signed little endian
AFMT_AC3 - AC3 (Dolby Digital) encoded audio
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au06
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/pcmin0 Intel HD Audio rec1 input (device index 6)
Legacy device /dev/dsp6
Caps: TRIGGER MMAP
Modes: INPUT
In engine 1: 6/Intel HD Audio rec1 input
Available for use
Engine 2: 10/Intel HD Audio pcm1 output (VMIX0)
Available for use
Engine 3: 11/Intel HD Audio pcm1 output (VMIX0)
Available for use
Engine 4: 12/Intel HD Audio pcm1 output (VMIX0)
Available for use
Engine 5: 13/Intel HD Audio pcm1 output (VMIX0)
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au07
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/pcmin1 Intel HD Audio rec2 input (device index 7)
Legacy device /dev/dsp7
Caps: TRIGGER MMAP
Modes: INPUT
In engine 1: 7/Intel HD Audio rec2 input
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au08
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/pcmin2 Intel HD Audio rec3 input (device index 8)
Legacy device /dev/dsp8
Caps: TRIGGER MMAP
Modes: INPUT
In engine 1: 8/Intel HD Audio rec3 input
Available for use
Input formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001010):
AFMT_S16_LE - 16 bit signed little endian
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au09
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
HW Type: Not indicated.
Minimum latency: Not indicated
/dev/oss/hdaudio0/spdin0 Intel HD Audio spdifin input (device index 9)
Legacy device /dev/dsp9
Caps: TRIGGER MMAP
Modes: INPUT
In engine 1: 9/Intel HD Audio spdifin input
Available for use
Input formats (0x00001410):
AFMT_S16_LE - 16 bit signed little endian
AFMT_AC3 - AC3 (Dolby Digital) encoded audio
AFMT_S32_LE - 32 bit signed little endian
Output formats (0x00001410):
AFMT_S16_LE - 16 bit signed little endian
AFMT_AC3 - AC3 (Dolby Digital) encoded audio
AFMT_S32_LE - 32 bit signed little endian
Device handle: OSS-PCI-au10
Related mixer dev: 0
Sample rate source: 0
Preferred channel configuration: Not indicated
Supported number of channels (min - max): 2 - 2
Native sample rates (min - max): 44100 - 96000 (44100,48000,96000)
HW Type: Not indicated.
Minimum latency: Not indicated
I did some debugging and it appears that find_output_space() (framework/audio/audio.c) fails to get free buffer space the second time around, first attempt does always succeeds (hence, one hears the "first quarter to half second of the file played").
More precisely it's oss_sleep() (kernel/OS/FreeBSD/os_freebsd.c), called from find_output_space(), that returns returns 0 because the timeout expired and it didn't succeed in getting a buffer within the timeout.
I added a printf() in oss_do_timing(). Here is a debug printout of a failure
- Code: Select all
483697909/1: =-=-=- Audio device 0 (Intel HD Audio pcm1 output) opened, ode 2 -=-=-=
483697911/2: Opened by PID: 9411
483697912/1: Opening process name: osstest
483697914/2: oss_audio_ioctl(0, SNDCTL_DSP_GETCAPS)
483697915/1: oss_audio_ioctl(0, SNDCTL_DSP_SETFMT, *0x00000010)
483697917/2: oss_audio_ioctl(0, SNDCTL_DSP_CHANNELS, *2)
483697918/1: Set channels 2
483697919/1: oss_audio_ioctl(0, SNDCTL_DSP_SPEED, *48000)
483697959/40: --- audio_write(0, 1351904) ---
483697960/1: No format conversions needed
483697961/1: setup_fragments(0, dir=2)
483697962/1: Max intrate 100 -> min buffer 1920
483697963/1: fragsz=2048, nfrags=32483697965/2: Prepare output dev=0, fragsize=2048, nfrags=32, bytes_in_use=65536/65536
483698075/110: 1351904/1351904 bytes to go
483698077/2: Got output buffer, offs 0/65536, len 65536
483698078/1: Move wrpointer, len 65536
483698079/1: User=65536
483698080/1: Byte=0
483698081/1: Fill=65536
483698082/1: Launch output called
483698083/1: Launch_output calling output_block
483698084/1: Launch_output calling trigger
483698086/2: 1286368/1351904 bytes to go
483698087/1: Sleep(0)
483699138/1051: Sleep(0) (out) timed out
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
483699145/7: =-=-=- Closing audio engine 0 -=-=-=
I haven't figured out where and how the buffers are allocated (DMA?), but hopefully somebody with a little more knowledge of OSS internals can provide a hint.