From: Anssi Hannula <anssi.hannula@iki.fi>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: hda - hdmi: Fallback to ALSA allocation when selecting CA
Date: Mon, 02 Sep 2013 17:14:02 +0300 [thread overview]
Message-ID: <52249D2A.5080201@iki.fi> (raw)
In-Reply-To: <s5hy57fbcf7.wl%tiwai@suse.de>
02.09.2013 16:06, Takashi Iwai kirjoitti:
> At Sun, 1 Sep 2013 14:36:47 +0300,
> Anssi Hannula wrote:
>> BTW, the hdmi_channel_allocation() logic seems also otherwise somewhat
>> suspect to me. Shouldn't we always select an allocation matching ALSA
>> channel mapping, instead of re-assigning channels received from
>> userspace "randomly" to sink speakers (in case of unusual sink speaker
>> mask)?
>
> If per_pin->chmap_set is set beforehand,
> hdmi_manual_channel_allocation() is called instead. So it should be
> fine.
I was talking about the "non-chmap" case.
Example:
Sink has FL + FR + FC + LFE.
Application plays 4 channel audio via ALSA, i.e. FL + FR + RL + RR as
per ALSA API channel allocation.
Instead of sending CA for FL + FR + RL + RR (0x06) which is what the
audio really is, hdmi_channel_allocation() selects CA for FL + FR + FC
+ LFE (0x03), since that is what the sink reported as present. As a
result rear channels are mapped to FC and LFE.
Of course this is rather unusual case (in terms of sink speaker mask),
and it may be argued that the user actually _wanted_ to output the
second pair of channels to FC+LFE despite them normally being RL+RR in ALSA.
> Takashi
>
>> Anyway, I let it be for now at least.
>>
>>
>> sound/pci/hda/patch_hdmi.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
>> index 030ca86..354fc55 100644
>> --- a/sound/pci/hda/patch_hdmi.c
>> +++ b/sound/pci/hda/patch_hdmi.c
>> @@ -551,6 +551,17 @@ static int hdmi_channel_allocation(struct hdmi_eld *eld, int channels)
>> }
>> }
>>
>> + if (!ca) {
>> + /* if there was no match, select the regular ALSA channel
>> + * allocation with the matching number of channels */
>> + for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) {
>> + if (channels == channel_allocations[i].channels) {
>> + ca = channel_allocations[i].ca_index;
>> + break;
>> + }
>> + }
>> + }
>> +
>> snd_print_channel_allocation(eld->info.spk_alloc, buf, sizeof(buf));
>> snd_printdd("HDMI: select CA 0x%x for %d-channel allocation: %s\n",
>> ca, channels, buf);
>> --
>> 1.8.1.5
>>
--
Anssi Hannula
next prev parent reply other threads:[~2013-09-02 14:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-01 11:36 [PATCH] ALSA: hda - hdmi: Fallback to ALSA allocation when selecting CA Anssi Hannula
2013-09-02 13:06 ` Takashi Iwai
2013-09-02 14:14 ` Anssi Hannula [this message]
2013-09-02 14:23 ` Takashi Iwai
2013-09-06 8:43 ` Ashecrow
2013-09-06 10:54 ` Takashi Iwai
2013-09-09 18:20 ` Ashecrow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52249D2A.5080201@iki.fi \
--to=anssi.hannula@iki.fi \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.