Summary: | Libcanberra does not play sounds in OMAP4 Pandaboard [PATCH]. | ||
---|---|---|---|
Product: | libcanberra | Reporter: | Wagner Volanin <freedesktop> |
Component: | Unspecified | Assignee: | Lennart Poettering <lennart> |
Status: | NEW --- | QA Contact: | |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | ARM | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | Patch to fill uninitialised values in hwparams in open_alsa() |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Created attachment 89236 [details] Patch to fill uninitialised values in hwparams in open_alsa() Libcanberra does not play sounds in the OMAP4 Pandaboard. This can be verified with this simple program: #include <stdlib.h> #include <canberra.h> int main( void ) { ca_context *context; ca_context_create (&context); ca_context_play (context, 0, CA_PROP_MEDIA_FILENAME, "file.wav", NULL); sleep (5); return 0; } The function ca_context_play() fails in open_alsa() file alsa.c, and returns errorcode -2 and errno 22. It fails more specifically in the function snd_pcm_hw_params(). The hwparams passed to the function have the following dump, retrieved with the function snd_pcm_hw_params_dump(): ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 16 CHANNELS: 1 RATE: 16000 PERIOD_TIME: [500 341000] PERIOD_SIZE: [8 5456] PERIOD_BYTES: [16 10912] PERIODS: (0 1366) BUFFER_TIME: [1000 682625] BUFFER_SIZE: [16 10922] BUFFER_BYTES: [32 21844] TICK_TIME: ALL As you can see, the parameters in brackets are uninitialised. This is the dump from hwparams in aplay, which plays the sound file perfectly: Playing WAVE 'file.wav' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono ACCESS: RW_INTERLEAVED FORMAT: S16_LE SUBFORMAT: STD SAMPLE_BITS: 16 FRAME_BITS: 16 CHANNELS: 1 RATE: 16000 PERIOD_TIME: 125000 PERIOD_SIZE: 2000 PERIOD_BYTES: 4000 PERIODS: 4 BUFFER_TIME: 500000 BUFFER_SIZE: 8000 BUFFER_BYTES: 16000 TICK_TIME: 0 It seems that the uninitialised parameters are causing some havoc with the OMAP4 audio hardware, although they work just fine in my macbook hardware. Just filling these parameters before calling snd_pcm_hw_params() in alsa_open() fixes the problem. For reference, I created the small attached patch based on aplay sourcecode. The patch just fills the uninitialised values the way aplay does. This is reproducible using libcanberra 0.28 to 0.30 Using ubuntu 12.04 fully updated with kernel 3.2 The architecture is armhf. I don't know if this problem affects other hardware.