OSDN Git Service

control: Fix a bug that prevented namehint behaviour
authorMark Hills <mark@xwax.org>
Mon, 22 Jun 2020 13:15:08 +0000 (14:15 +0100)
committerTakashi Iwai <tiwai@suse.de>
Tue, 23 Jun 2020 10:49:36 +0000 (12:49 +0200)
commita510754af245357f58d7c942168b8a89ad273fdd
treec31f08d374e15957d9cd702b05b5a4e8a8dd58b7
parent6be096eed96a6595f445352da993cd0a28baba72
control: Fix a bug that prevented namehint behaviour

Looks like the documented behaviour was broken in commit 1ba513f9 in
2006, with the introduction of multiple fields.

I've chosen to match the described behaviour. Prior to this patch,
using namehint could be made to work by exploiting the lack of escaping
of the "name", populating the other fields:

  "plug:front|DESCDo all conversions for front speakers"

rather than that which is documented and presumed to be the intention
for asoundrc files:

  "plug:front|Do all conversions for front speakers"

Everything seems to strongly suggest nobody is using this feature; I can
find no working examples through a web search and probably someone
would have hit this bug. It's not documented in configuration, only in
the snd_device_name_hint() call. So it would probably clutter things to
provide compatibility for the old behaviour.

I have found it to be very useful since working in Chromium, where it is
the only way to expose chosen ALSA devices to web applications.

A temporary buffer is required to null-terminate the string.  I see no
use of alloca() in the code, presumably to avoid unbounded stack size.
So memory is allocated on the heap.

Signed-off-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/control/namehint.c