[alsa-devel] [PATCH 1/3 v2] speaker-test: Fix chmapped channel selection without specified chmap

Takashi Iwai tiwai at suse.de
Tue Nov 12 09:11:36 CET 2013


At Tue, 12 Nov 2013 00:04:02 +0200,
Anssi Hannula wrote:
> 
> The channel selection currently does not work properly when there is a
> driver-provided non-ALSA-traditional channel map but no manual channel
> map was explicitely requested with "-m".
> 
> For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note
> that it is otherwise the same as the traditional ALSA channel map,
> except that the traditional rear speakers are considered
> rear-center speakers and the traditional side speakers are considered
> rear speakers.
> 
> Speaker-test tries to play back channels in this following order:
>   0, /* Front Left  */
>   4, /* Center      */
>   1, /* Front Right */
>   7, /* Side Right  */
>   3, /* Rear Right  */
>   2, /* Rear Left   */
>   6, /* Side Left   */
>   5, /* LFE         */
> 
> When it is the time to play back Side Left/Right, speaker-test tries to
> look for SL/SR in the chmap, but doesn't find it, so it just plays back
> channels 6/7 (which indeed are the side speakers, or RL/RR in this
> channel map - so the correct channels are selected).
> 
> When it becomes the time to playback Rear Left/Right, speaker-test again
> tries to find RL/RR in the chmap, and this time it does find them in the
> chmap positions 6/7.
> 
> So the channels 6/7 are tested twice and 2/3 are never tested.
> 
> To fix this, define a generic playback order channel_order[] to be used
> when the channel map is present (but not user-defined) and generate a
> (speaker/playback number => channel number) mapping with the channels
> ordered in the following order:
> 1. regular channels found in channel_order[] in the defined order,
> 2. channels not found in channel_order[] ordered by channel number.
> 3. UNKNOWN channels ordered by channel number.
> 4. NA channels ordered by channel number.
> For channels outside the channel map just use their channel numbers (so
> they will be last after all of the above).
> 
> For example, if the playback device has a fictional default channel map
> of FR,FL,UNKNOWN1,FOO,BAR,RR,RL,UNKNOWN2, the playback order will be
> FL,FR,RR,RL,FOO,BAR,UNKNOWN1,UNKNOWN2(,any_extra_channels).
> 
> When the channel mapping is specified manually, the specified order is
> used for playback as before.
> 
> Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>

Thanks, applied all three patches now.


Takashi


More information about the Alsa-devel mailing list