Bug#578720: vorbis-tools: Sends invalid argument to ALSA when playing some files

Ron ron at debian.org
Fri Dec 12 21:04:09 UTC 2014


Hi Martin,

On Fri, Dec 12, 2014 at 07:14:28PM +0100, Martin Steghöfer wrote:
> severity 578720 minor
> thanks
> 
> 
> Martin Steghöfer wrote:
> >The error message here is a bit cryptic. What it tries to say is: Your
> >output device doesn't support Mono playback and no software in the output
> >pipeline [...] is willing to do the necessary upmixing [...] Doing the
> >upmixing in ogg123 is certainly out of its scope and libao also seems too
> >simple. [...]
> 
> Hmmm, however, what could be done about this issue is to improve the error
> message, so it tells the user that the mode isn't supported by the user's
> hardware, instead of talking about an "invalid argument". Unfortunately,
> this message isn't produced by ogg123. The string "invalid argument" comes
> from ALSA ("snd_strerror") and it's printed by libao (in "ao_plugin_open").
> So either of them could improve the wording.
> 
> What do the libao maintainers (Ron and John in CC) think about this? Should
> I reassign this to the libao package?

Actually, it's not clear to me that this error message is coming out of
libao at all.  Or at least nothing I see in the libao source corresponds
to the interesting part of the original report:

 Playing: /data/Sounds/Barbara_Allen.ogg
 Ogg Vorbis stream: 1 channel, 44100 Hz
 ALSA snd_pcm_hw_params_set_channels error: Invalid argument
 Error: Cannot open device alsa.


The last line there comes out of ogg123 after ao_open_live() has failed
(which failed because the snd_pcm_hw_params_set_channels() alsa-lib call
failed to configure alsa to use 1 channel on the user's hardware).
And I assume the reason it worked for Adrian is that his audio hardware
does support that.

The second to last line appears to have come from alsa-lib itself,
I don't see anything in libao that would emit that.  And it combined
with the previous line (1 channel, 44100 Hz) should at least hint at
the idea that "set_channels(1)" failed.

It might be a little counter-intuitive until you realise some hardware
simply can't handle mono output, but it's not clear to me that anything
above the level of alsa-lib can really second-guess (or report) why it
failed in any more detailed way.


It's not really a bug in libao as such; ogg123 tells libao the format of
the audio it wants to stream to it, and libao can either open a stream
that can accept that format or it can't.  It's not really libao's job to
try to guess how it might resample or remix the input to a format that
is acceptable.

Whether or not it's a bug in ogg123 really depends on whether you think
that application should be able to resample and/or remix input that the
hardware does not directly support.  I'm pretty sure things like aplay
will also fail in the same way for the same combination of input and
hardware (at least I've seen it do the same thing for mono files on
some hardware before too).

The choices are basically:

 - Use a "higher level" player that can resample/remix.
 - Manually do that before using simple tools like ogg123/aplay etc.
   to play it.
 - Make ogg123 a "higher level" player.
 - Use an output stream other than alsa which can do this.
 - Use better hardware.


You'd see exactly the same sort of failure if the input stream was in
some other form that wasn't supported by the hardware/alsa driver too
(ie. multiple channel surround or an oddball sample rate).


So sorry, I don't really see an easy out that just lets you punt this
one to someone else :)  But it's also not really a "bug" in ogg123
either, except possibly if you want to document this in more detail
for it (if it's not already and I just can't see it).  It could in
theory try to use a bigger hammer to force a square peg into a round
hole, but that's probably out of scope for a very simple player like
this one.

  Cheers,
  Ron



More information about the pkg-xiph-maint mailing list