[alsa-devel] ALSA SDL VORBIS playback problem
I'm using SDL on an ARM based board running Linux (Olimex-AT91SAM9261) . I successfully cross-compiled, installed and tested the libraries (SDL, SDL_mixer) on the system. The sound output is done thru ALSA (SDL_AUDIODRIVER=alsa). And the ogg file decoding thru libvorbis/libvorbisfile libraries.
Now I'm trying to play ogg files. First I used the Mix_LoadWAV macro from the SDL_Mixer library for playback. This worked, but the macro decompresses first the complete audio file into memory and then starts the playback. Thus leading to a long delay before playing the music. Therefore I tried a different approach with the Mix_LoadMUS macro (SDL_mixer) to play the ogg file. This function streams the files directly from the hard-disk and avoids the long decoding time. Unfortunately ALSA shows several buffer under-runs leading to a disrupted playback. To fix this I tried different buffer sizes, but the problem is still existent.
The code works fine on my host system, but not on the ARM target. And i'm not sure if these problems are caused by the ALSA lib?
Any sort of help would be great!
Thanks in advance Christian ___________________________________________________________ GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT! Jetzt freischalten unter http://movieflat.web.de
Experiment. On the arm board:
$ oggdec myfile.ogg -o - | aplay -
Basically, see if a straight-up pipe will buffer reasonably. If not, I suppose it's remotely possible that this is just a CPU-bound operation and it can't keep up. I can't imagine that's really the case though with that CPU.
On Tue, Mar 2, 2010 at 11:50 AM, Christian Wolf wolflpz@web.de wrote:
I'm using SDL on an ARM based board running Linux (Olimex-AT91SAM9261) . I successfully cross-compiled, installed and tested the libraries (SDL, SDL_mixer) on the system. The sound output is done thru ALSA (SDL_AUDIODRIVER=alsa). And the ogg file decoding thru libvorbis/libvorbisfile libraries.
Now I'm trying to play ogg files. First I used the Mix_LoadWAV macro from the SDL_Mixer library for playback. This worked, but the macro decompresses first the complete audio file into memory and then starts the playback. Thus leading to a long delay before playing the music. Therefore I tried a different approach with the Mix_LoadMUS macro (SDL_mixer) to play the ogg file. This function streams the files directly from the hard-disk and avoids the long decoding time. Unfortunately ALSA shows several buffer under-runs leading to a disrupted playback. To fix this I tried different buffer sizes, but the problem is still existent.
The code works fine on my host system, but not on the ARM target. And i'm not sure if these problems are caused by the ALSA lib?
Any sort of help would be great!
Thanks in advance Christian ___________________________________________________________ GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT! Jetzt freischalten unter http://movieflat.web.de _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On 03/02/2010 08:09 PM, Alex Austin wrote:
Basically, see if a straight-up pipe will buffer reasonably. If not, I suppose it's remotely possible that this is just a CPU-bound operation and it can't keep up. I can't imagine that's really the case though with that CPU.
Libvorbis uses floating point operations while on your AT91SAM9261 you have a soft-float library (or even worse FPU emulation).
Try the integer only Tremor library linked here: http://www.xiph.org/vorbis/
The API is slightly different (easier), as it can only generate S16_LE samples.
Daniel
libtremor fixed the problem. it seems the arm cpu was to busy with decoding ogg files thru the vorbis/ogg floating point libraries.
therefore i did the following:
1. i downloaded the sources for libtremor from the svn: [http://svn.xiph.org/trunk/Tremor/] 2. cross compiled them for my arm board 3. i also had to cross compile the SDL_mixer library again by adding the parameter "--enable-music-ogg-tremor" to the configure command
These steps finally fixed the buffer underrun problem completely.
Thanks for the help!!!
Christian
53baa24a1003021109xe1c76dekc7f390a2a851df28@mail.gmail.com, 4B8D6F02.1060608@emlix.com In-Reply-To: 4B8D6F02.1060608@emlix.com Subject: Re: [alsa-devel] ALSA SDL VORBIS playback problem Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-UI-Message-Type: mail X-UI-ATTACHMENT-ID-POSTFIX: 13a75ccc-b8f8-47b0-a4d0-35dc155c214c
-----Urspr=FCngliche Nachricht----- Von: "Daniel Glöckner" dg@emlix.com Gesendet: 02-Mar-2010 21:03:14 An: Christian Wolf wolflpz@web.de Betreff: Re: [alsa-devel] ALSA SDL VORBIS playback problem
On 03/02/2010 08:09 PM, Alex Austin wrote:
Basically, see if a straight-up pipe will buffer reasonably. If not, I suppose it's remotely possible that this is just a CPU-bound operation an=
d
it can't keep up. I can't imagine that's really the case though with that CPU.
Libvorbis uses floating point operations while on your AT91SAM9261 you have a soft-float library (or even worse FPU emulation).
Try the integer only Tremor library linked here: http://www.xiph.org/vorbis/
The API is slightly different (easier), as it can only generate S16_LE samples.
Daniel
-- =3D
Dipl.-Math. Daniel Gl=3DF6ckner, emlix GmbH, http://www.emlix.com Fon +49 551 30664-0, Fax -11, Bahnhofsallee 1b, 37081 G=3DF6ttingen, German= y Sitz der Gesellschaft: G=3DF6ttingen, Amtsgericht G=3DF6ttingen HR B 3160 Gesch=3DE4ftsf=3DFChrer: Dr. Uwe Kracke, Ust-IdNr.: DE 205 198 055
emlix - your embedded linux partner _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ___________________________________________________________ WEB.DE DSL: Internet, Telefon und Entertainment für nur 19,99 EUR/mtl.! http://produkte.web.de/go/02/
participants (3)
-
Alex Austin
-
Christian Wolf
-
Daniel Glöckner