[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#930088: mpg123 plays back gibberish instead of music from mp3 files



Am Mon, 24 Jun 2019 22:54:23 +0000 (UTC)
schrieb Thorsten Glaser <tg@debian.org>: 

> >I suspect the link from alsa to pulse is faulty, as mpg123's alsa output module
> >has been working fine for a long time now using proper alsa.  

I just had some reproducable playback trouble on a Ubuntu 18.04 box and
mpg123 -o alsa as opposed to mpg123 -o pulse: A brief period of static
noise and reported ALSA underruns on loading a new track. This hints at
some performance/timing issue that at least triggers this. I fixed it
in current mpg123 trunk by delaying device activation based on the
ringbuffer fill.

We used to have this in src/libout123/modules/alsa.c for a long time
(so, also in current Debian):

	snd_pcm_sw_params_set_start_threshold(pcm, sw, 1)

This starts the audio device as soon as the first block of audio is
there. Strangely, this seems to work fine for real hardware or ALSA's
dmix stuff (where I'd expect the real trouble), but fails when being
decoupled via pulse. I changed that now to

	snd_pcm_sw_params_set_start_threshold(pcm, sw, buffer_size/2)

and this seems to work fine in my tests. Maybe someone can confirm with
a build from the current https://mpg123.org/snapshot, or just this
little change applied to the debian package?

Interestingly enough, just not setting this value (relying on a
sensible default) does not help. The default doesn't seem to be
sensible.

A current workaround is to simply activate mpg123's background buffer
using mpg123 -b 512 (or any other number that feels good), it contains
logic probaby rather similar to ALSA's to start playback only after a
certain amount of PCM data is ready.


Alrithty then,

Thomas

PS: This may be a good time to be prepared for a general update of the
Debian package, as I really, really intend to finish mpg123 1.26.0
soon, with a rather disturbingly big amount of fixes and additions. I
have hope to really get it done this time (month, year, decade).


Reply to: