Add support for 5.1.4 and 7.1.4 audio channel layouts [chromium/src : main]

0 views
Skip to first unread message

Syed AbuTalib (Gerrit)

unread,
Mar 11, 2026, 2:00:44 PMMar 11
to Thomas Guilbert, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
Attention needed from Thomas Guilbert

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Thomas Guilbert
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
Gerrit-Change-Number: 7647325
Gerrit-PatchSet: 5
Gerrit-Owner: Syed AbuTalib <low...@google.com>
Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Mar 2026 18:00:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Thomas Guilbert (Gerrit)

unread,
Mar 12, 2026, 9:01:05 PMMar 12
to Syed AbuTalib, Thomas Guilbert, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
Attention needed from Syed AbuTalib

Thomas Guilbert added 3 comments

File media/audio/android/aaudio_stream_wrapper.cc
Line 258, Patchset 5 (Latest): if (layout == CHANNEL_LAYOUT_DISCRETE) {
switch (channels) {
case 10:
// Map to canonical AAUDIO_CHANNEL_5POINT1POINT4 channel mask for
// 10-channel PCM MediaCodec decoded audio. This ensures
// compatibility with Android devices for signaling 10-channel output.
return AAUDIO_CHANNEL_5POINT1POINT4;
case 12:
// Map to canonical AAUDIO_CHANNEL_7POINT1POINT4 channel mask for
// 12-channel PCM MediaCodec decoded audio. This ensures
// compatibility with Android devices for signaling 12-channel output.
return AAUDIO_CHANNEL_7POINT1POINT4;
default:
return std::nullopt;
}
}
Thomas Guilbert . unresolved

This should be cleaned up whenever we allow 12 channels. Add a TODO to track this?

File media/audio/cras/cras_input.cc
Line 272, Patchset 5 (Latest): static const std::optional<int> kChannelMap[] = {
CRAS_CH_FL, CRAS_CH_FR, CRAS_CH_FC, CRAS_CH_LFE, CRAS_CH_RL, CRAS_CH_RR,
CRAS_CH_FLC, CRAS_CH_FRC, CRAS_CH_RC, CRAS_CH_SL, CRAS_CH_SR,
// CRAS doesn't currently define explicit mappings for 7.1.4 height
// channels.
std::nullopt, std::nullopt, std::nullopt, std::nullopt};
Thomas Guilbert . unresolved

The optional is a bit strange here. I see you're trying to respect the static_assert, but to add these `std::nullopt` only to skip them is a bit odd.

A `constexpr int kUnsupportedTopChannel` instead of `std::nullopt` would already be a bit clearer in its intent, even though I still think it looks odd, since we will never loop over them.

Another alternative:

I think one of Jordan's CLs will introduce a direct layout to mask function: http://crrev.com/c/7631615/14/media/base/channel_layout.h

If you wanted things to be fancy and explicit in the intent, cou could take the output of that function, make a bit mask for "supported cras channels" and `&` the two masks, and then populate `layout` accordingly.

File media/audio/cras/cras_unified.cc
Line 203, Patchset 5 (Latest): static_assert(std::size(kChannelMap) == CHANNELS_MAX + 1,
Thomas Guilbert . unresolved

Same comment

Open in Gerrit

Related details

Attention is currently required from:
  • Syed AbuTalib
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
    Gerrit-Change-Number: 7647325
    Gerrit-PatchSet: 5
    Gerrit-Owner: Syed AbuTalib <low...@google.com>
    Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Syed AbuTalib <low...@google.com>
    Gerrit-Comment-Date: Fri, 13 Mar 2026 01:00:56 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Syed AbuTalib (Gerrit)

    unread,
    Mar 16, 2026, 4:42:47 PMMar 16
    to Thomas Guilbert, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
    Attention needed from Thomas Guilbert

    Syed AbuTalib added 3 comments

    File media/audio/android/aaudio_stream_wrapper.cc
    Line 258, Patchset 5: if (layout == CHANNEL_LAYOUT_DISCRETE) {

    switch (channels) {
    case 10:
    // Map to canonical AAUDIO_CHANNEL_5POINT1POINT4 channel mask for
    // 10-channel PCM MediaCodec decoded audio. This ensures
    // compatibility with Android devices for signaling 10-channel output.
    return AAUDIO_CHANNEL_5POINT1POINT4;
    case 12:
    // Map to canonical AAUDIO_CHANNEL_7POINT1POINT4 channel mask for
    // 12-channel PCM MediaCodec decoded audio. This ensures
    // compatibility with Android devices for signaling 12-channel output.
    return AAUDIO_CHANNEL_7POINT1POINT4;
    default:
    return std::nullopt;
    }
    }
    Thomas Guilbert . resolved

    This should be cleaned up whenever we allow 12 channels. Add a TODO to track this?

    Syed AbuTalib

    Done

    File media/audio/cras/cras_input.cc
    Line 272, Patchset 5: static const std::optional<int> kChannelMap[] = {

    CRAS_CH_FL, CRAS_CH_FR, CRAS_CH_FC, CRAS_CH_LFE, CRAS_CH_RL, CRAS_CH_RR,
    CRAS_CH_FLC, CRAS_CH_FRC, CRAS_CH_RC, CRAS_CH_SL, CRAS_CH_SR,
    // CRAS doesn't currently define explicit mappings for 7.1.4 height
    // channels.
    std::nullopt, std::nullopt, std::nullopt, std::nullopt};
    Thomas Guilbert . resolved

    The optional is a bit strange here. I see you're trying to respect the static_assert, but to add these `std::nullopt` only to skip them is a bit odd.

    A `constexpr int kUnsupportedTopChannel` instead of `std::nullopt` would already be a bit clearer in its intent, even though I still think it looks odd, since we will never loop over them.

    Another alternative:

    I think one of Jordan's CLs will introduce a direct layout to mask function: http://crrev.com/c/7631615/14/media/base/channel_layout.h

    If you wanted things to be fancy and explicit in the intent, cou could take the output of that function, make a bit mask for "supported cras channels" and `&` the two masks, and then populate `layout` accordingly.

    Syed AbuTalib

    Ended up going with the `constexpr int kUnsupportedTopChannel` route. Marking as resolved.

    File media/audio/cras/cras_unified.cc
    Line 203, Patchset 5: static_assert(std::size(kChannelMap) == CHANNELS_MAX + 1,
    Thomas Guilbert . resolved

    Same comment

    Syed AbuTalib

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Thomas Guilbert
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
      Gerrit-Change-Number: 7647325
      Gerrit-PatchSet: 6
      Gerrit-Owner: Syed AbuTalib <low...@google.com>
      Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
      Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
      Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
      Gerrit-Comment-Date: Mon, 16 Mar 2026 20:42:38 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Thomas Guilbert <tgui...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Thomas Guilbert (Gerrit)

      unread,
      Mar 18, 2026, 5:12:16 PMMar 18
      to Syed AbuTalib, Thomas Guilbert, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org
      Attention needed from Syed AbuTalib

      Thomas Guilbert voted and added 6 comments

      Votes added by Thomas Guilbert

      Code-Review+1

      6 comments

      Patchset-level comments
      File-level comment, Patchset 10 (Latest):
      Thomas Guilbert . resolved

      LGTM % Nits

      Commit Message
      Line 16, Patchset 10 (Latest):* CRAS does not support height channels, created `kUnsupportedChannel` to ignore such channels.
      Thomas Guilbert . unresolved

      NIT: format the description to fit in 80 char (overly long URL is fine though)

      File media/audio/cras/cras_input.cc
      Line 271, Patchset 10 (Latest): static constexpr int kUnsupportedChannel = -1;
      Thomas Guilbert . unresolved

      Nit: in `layout` itself, `-1` means no mapping. Try using a different invalid constant, like `-123` or anything else that should help catch errors if this code is changed.

      Line 275, Patchset 10 (Latest): // CRAS doesn't currently define explicit mappings for 7.1.4 height
      Thomas Guilbert . unresolved

      Nit: height channels are not limited to `7.1.4`. `x.y.4 height channels` or just `height channels` is more correct here.

      File media/audio/cras/cras_unified.cc
      Line 196, Patchset 10 (Latest): static constexpr int kUnsupportedChannel = -1;
      Thomas Guilbert . unresolved

      Ditto.

      Line 200, Patchset 10 (Latest): // CRAS doesn't currently define explicit mappings for 7.1.4 height
      Thomas Guilbert . unresolved

      Ditto ditto.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Syed AbuTalib
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
      Gerrit-Change-Number: 7647325
      Gerrit-PatchSet: 10
      Gerrit-Owner: Syed AbuTalib <low...@google.com>
      Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
      Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
      Gerrit-Attention: Syed AbuTalib <low...@google.com>
      Gerrit-Comment-Date: Wed, 18 Mar 2026 21:12:06 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Syed AbuTalib (Gerrit)

      unread,
      Mar 19, 2026, 7:23:49 PMMar 19
      to Thomas Guilbert, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org

      Syed AbuTalib added 5 comments

      Commit Message
      Line 16, Patchset 10:* CRAS does not support height channels, created `kUnsupportedChannel` to ignore such channels.
      Thomas Guilbert . resolved

      NIT: format the description to fit in 80 char (overly long URL is fine though)

      Syed AbuTalib

      Done

      File media/audio/cras/cras_input.cc
      Line 271, Patchset 10: static constexpr int kUnsupportedChannel = -1;
      Thomas Guilbert . resolved

      Nit: in `layout` itself, `-1` means no mapping. Try using a different invalid constant, like `-123` or anything else that should help catch errors if this code is changed.

      Syed AbuTalib

      Went with -4 in honor of the number of height channels.

      Line 275, Patchset 10: // CRAS doesn't currently define explicit mappings for 7.1.4 height
      Thomas Guilbert . resolved

      Nit: height channels are not limited to `7.1.4`. `x.y.4 height channels` or just `height channels` is more correct here.

      Syed AbuTalib

      Done

      File media/audio/cras/cras_unified.cc
      Line 196, Patchset 10: static constexpr int kUnsupportedChannel = -1;
      Thomas Guilbert . resolved

      Ditto.

      Syed AbuTalib

      Done

      Line 200, Patchset 10: // CRAS doesn't currently define explicit mappings for 7.1.4 height
      Thomas Guilbert . resolved

      Ditto ditto.

      Syed AbuTalib

      Done

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
        Gerrit-Change-Number: 7647325
        Gerrit-PatchSet: 13
        Gerrit-Owner: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
        Gerrit-Comment-Date: Thu, 19 Mar 2026 23:23:39 +0000
        satisfied_requirement
        open
        diffy

        Syed AbuTalib (Gerrit)

        unread,
        Mar 19, 2026, 7:23:56 PMMar 19
        to Thomas Guilbert, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org

        Syed AbuTalib voted Commit-Queue+2

        Commit-Queue+2
        Open in Gerrit

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
        Gerrit-Change-Number: 7647325
        Gerrit-PatchSet: 13
        Gerrit-Owner: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
        Gerrit-Comment-Date: Thu, 19 Mar 2026 23:23:45 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        Syed AbuTalib (Gerrit)

        unread,
        Mar 20, 2026, 1:38:08 PMMar 20
        to Thomas Guilbert, Chromium LUCI CQ, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org

        Syed AbuTalib voted Commit-Queue+2

        Commit-Queue+2
        Open in Gerrit

        Related details

        Attention set is empty
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
        Gerrit-Change-Number: 7647325
        Gerrit-PatchSet: 14
        Gerrit-Owner: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
        Gerrit-Comment-Date: Fri, 20 Mar 2026 17:37:57 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        Chromium LUCI CQ (Gerrit)

        unread,
        Mar 20, 2026, 2:42:10 PMMar 20
        to Syed AbuTalib, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org, mac-r...@chromium.org

        Chromium LUCI CQ submitted the change with unreviewed changes

        Unreviewed changes

        10 is the latest approved patch-set.
        The change was submitted with unreviewed changes in the following files:

        ```
        The name of the file: media/audio/cras/cras_input.cc
        Insertions: 2, Deletions: 2.

        The diff is too large to show. Please review the diff.
        ```
        ```
        The name of the file: media/audio/cras/cras_unified.cc
        Insertions: 2, Deletions: 2.

        The diff is too large to show. Please review the diff.
        ```

        Change information

        Commit message:
        Add support for 5.1.4 and 7.1.4 audio channel layouts

        Add new `5_1_4` and `7_1_4` enums, as well as the associated height
        Channels. Update switch cases to handle these new enums. Note that we
        are not upgrading kMaxConcurrentChannels until later, leading us to skip
        select tests for now.

        Adding such enums leads to OS specific updates:
        * Add the height channels to `kMediaChannelToAAudioChannel` (refer to https://developer.android.com/ndk/reference/group/audio#group___audio_1gac36f475ca5b446f4fde4c9b90bec77c8)

        * CRAS does not support height channels, created `kUnsupportedChannel` to
        ignore such channels.
        * Add `kAudioChannelLabel_*` to MacOS specific cases.
        Bug: 474106765
        Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
        Reviewed-by: Thomas Guilbert <tgui...@chromium.org>
        Commit-Queue: Syed AbuTalib <low...@google.com>
        Cr-Commit-Position: refs/heads/main@{#1602753}
        Files:
        • M media/audio/android/aaudio_stream_wrapper.cc
        • M media/audio/cras/cras_input.cc
        • M media/audio/cras/cras_unified.cc
        • M media/base/channel_layout.cc
        • M media/base/channel_layout.h
        • M media/base/channel_mixer_unittest.cc
        • M media/base/channel_mixing_matrix_unittest.cc
        • M media/base/mac/channel_layout_util_mac.cc
        • M media/base/mac/channel_layout_util_mac_unittest.cc
        Change size: M
        Delta: 9 files changed, 151 insertions(+), 52 deletions(-)
        Branch: refs/heads/main
        Submit Requirements:
        • requirement satisfiedCode-Review: +1 by Thomas Guilbert
        Open in Gerrit
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: merged
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I934605b74fec50c51e852ecf4de7dbec6f2e2e26
        Gerrit-Change-Number: 7647325
        Gerrit-PatchSet: 15
        Gerrit-Owner: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        Gerrit-Reviewer: Syed AbuTalib <low...@google.com>
        Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
        open
        diffy
        satisfied_requirement
        Reply all
        Reply to author
        Forward
        0 new messages