Refactor Android audio code to clarify use of communication devices [chromium/src : main]

0 views
Skip to first unread message

Maya Jelonkiewicz (Gerrit)

unread,
Mar 3, 2025, 9:06:37 AM3/3/25
to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Dale Curtis and Thomas Guilbert

Message from Maya Jelonkiewicz

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • Dale Curtis
  • Thomas Guilbert
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
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: I776fe6c57ed926e33293998d800400768a1e4833
Gerrit-Change-Number: 6316647
Gerrit-PatchSet: 1
Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
Gerrit-Comment-Date: Mon, 03 Mar 2025 14:06:28 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Dale Curtis (Gerrit)

unread,
Mar 3, 2025, 12:57:00 PM3/3/25
to Maya Jelonkiewicz, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
Attention needed from Maya Jelonkiewicz and Thomas Guilbert

Dale Curtis added 2 comments

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Dale Curtis . unresolved

I'm a bit concerned this is muddying the details around input-only device selection -- though it's possible that doesn't work on Android today.

File media/audio/android/audio_manager_android.cc
Line 147, Patchset 1 (Latest): Java_AudioManagerAndroid_getCommunicationDeviceNames(
Dale Curtis . unresolved

Is it not possible to have an input only device on Android?

Open in Gerrit

Related details

Attention is currently required from:
  • Maya Jelonkiewicz
  • Thomas Guilbert
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Mon, 03 Mar 2025 17:56:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Thomas Guilbert (Gerrit)

    unread,
    Mar 3, 2025, 2:42:23 PM3/3/25
    to Maya Jelonkiewicz, Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz

    Thomas Guilbert added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 173, Patchset 1 (Latest): // When using streams with communication usage set, the output device is
    // automatically selected by the Android framework based on the input device.
    // Thus, there is no reason to expose an output device selection.
    Thomas Guilbert . unresolved

    Mirroring Dale's question, how should a user select between multiple output-only devices of the same type? I think we allow 2 BT devices to be connected at once, and some of these don't have microphones.

    I know this is an edge-case and might not need to be addressed now (we currently don't), but just something to keep in mind.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Mon, 03 Mar 2025 19:42:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 4, 2025, 11:29:49 AM3/4/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 3 comments

    Patchset-level comments
    Dale Curtis . unresolved

    I'm a bit concerned this is muddying the details around input-only device selection -- though it's possible that doesn't work on Android today.

    Maya Jelonkiewicz

    Could you elaborate on that? Unless the other comment thread covers this.

    File media/audio/android/audio_manager_android.cc
    Line 147, Patchset 1 (Latest): Java_AudioManagerAndroid_getCommunicationDeviceNames(
    Dale Curtis . unresolved

    Is it not possible to have an input only device on Android?

    Maya Jelonkiewicz

    It is possible, but it won't be listed as a communication device (meaning it's only usable in Clank via the "default device" route).

    Line 173, Patchset 1 (Latest): // When using streams with communication usage set, the output device is
    // automatically selected by the Android framework based on the input device.
    // Thus, there is no reason to expose an output device selection.
    Thomas Guilbert . unresolved

    Mirroring Dale's question, how should a user select between multiple output-only devices of the same type? I think we allow 2 BT devices to be connected at once, and some of these don't have microphones.

    I know this is an edge-case and might not need to be addressed now (we currently don't), but just something to keep in mind.

    Maya Jelonkiewicz

    If the device is output-only, it's not selectable at all, as there won't be a corresponding communication device for it.
    Android does allow multiple BT devices to be connected at once, but only one audio device ends up available for use by apps. That also goes for other types like USB. You are right though that this could change. We could definitely enhance the communication device-based audio management scheme to account for this case.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Tue, 04 Mar 2025 16:29:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
    Comment-In-Reply-To: Thomas Guilbert <tgui...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 4, 2025, 12:13:10 PM3/4/25
    to Maya Jelonkiewicz, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis added 4 comments

    Patchset-level comments
    Dale Curtis . unresolved

    I'm a bit concerned this is muddying the details around input-only device selection -- though it's possible that doesn't work on Android today.

    Maya Jelonkiewicz

    Could you elaborate on that? Unless the other comment thread covers this.

    Dale Curtis

    On other platforms communications devices specifically means a paired input/output device. It's possible to have standalone input and output devices. I'm trying to understand if this CL is diverging from that pattern or just bowing to Android's limitations. If the latter it needs a lot more comments on why we want to put communications in the name of things that should be more generic.

    File media/audio/android/audio_manager_android.cc
    Line 147, Patchset 1 (Latest): Java_AudioManagerAndroid_getCommunicationDeviceNames(
    Dale Curtis . unresolved

    Is it not possible to have an input only device on Android?

    Maya Jelonkiewicz

    It is possible, but it won't be listed as a communication device (meaning it's only usable in Clank via the "default device" route).

    Dale Curtis

    I mean on other platforms this list is generally the list of all selectable devices, not just paired input/output communications devices. Given your other comments it sounds like these aren't selectable / listable though?

    Line 173, Patchset 1 (Latest): // When using streams with communication usage set, the output device is
    // automatically selected by the Android framework based on the input device.
    // Thus, there is no reason to expose an output device selection.
    Thomas Guilbert . unresolved

    Mirroring Dale's question, how should a user select between multiple output-only devices of the same type? I think we allow 2 BT devices to be connected at once, and some of these don't have microphones.

    I know this is an edge-case and might not need to be addressed now (we currently don't), but just something to keep in mind.

    Maya Jelonkiewicz

    If the device is output-only, it's not selectable at all, as there won't be a corresponding communication device for it.
    Android does allow multiple BT devices to be connected at once, but only one audio device ends up available for use by apps. That also goes for other types like USB. You are right though that this could change. We could definitely enhance the communication device-based audio management scheme to account for this case.

    Dale Curtis

    On windows the default and the default-communications device are separate things:
    https://source.chromium.org/chromium/chromium/src/+/main:media/audio/win/audio_manager_win.cc;l=176;drc=b4dcc60457a349c18efddcd6347cc4e8d27174ab

    Is there a reason to diverge here?

    Line 369, Patchset 1 (Latest): if (!SetCommunicationDevice(device_id)) {
    Dale Curtis . unresolved

    I believe on Windows we'd only do this if the device_id == default_communications.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Tue, 04 Mar 2025 17:12:59 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
    Comment-In-Reply-To: Thomas Guilbert <tgui...@chromium.org>
    Comment-In-Reply-To: Maya Jelonkiewicz <mj...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 5, 2025, 8:57:20 AM3/5/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 4 comments

    Patchset-level comments
    Dale Curtis . unresolved

    I'm a bit concerned this is muddying the details around input-only device selection -- though it's possible that doesn't work on Android today.

    Maya Jelonkiewicz

    Could you elaborate on that? Unless the other comment thread covers this.

    Dale Curtis

    On other platforms communications devices specifically means a paired input/output device. It's possible to have standalone input and output devices. I'm trying to understand if this CL is diverging from that pattern or just bowing to Android's limitations. If the latter it needs a lot more comments on why we want to put communications in the name of things that should be more generic.

    Maya Jelonkiewicz

    I should underline first and foremost that this CL doesn't introduce behavior changes, just a refactor. I am following the existing implementation.

    We are indeed bowing to Android's limitations here. For one, on SDK < 29 we fallback to OpenSL ES, which doesn't expose per-stream device selection, so managing the system communication device is the only option to influence the device used by a stream. AFAIK Clank targets SDK 26+, and AAudio is also 26+, so we could perhaps drop OpenSL ES support, but there is also another reason - vendor devices may or may not respect per-stream device selection (e.g. they may route all streams with the same usage to one device, or exhibit clashes when using two seperate audio devices, and this might even happen silently). On the other hand, there is good support for the communication usage path, to allow for device selection in voice/video call apps. This is why the communication device-based approach for device selection is relevant and will need to stay around, even with per-stream device selection implemented.

    File media/audio/android/audio_manager_android.cc
    Line 147, Patchset 1 (Latest): Java_AudioManagerAndroid_getCommunicationDeviceNames(
    Dale Curtis . unresolved

    Is it not possible to have an input only device on Android?

    Maya Jelonkiewicz

    It is possible, but it won't be listed as a communication device (meaning it's only usable in Clank via the "default device" route).

    Dale Curtis

    I mean on other platforms this list is generally the list of all selectable devices, not just paired input/output communications devices. Given your other comments it sounds like these aren't selectable / listable though?

    Maya Jelonkiewicz

    Yes, specifically, they are not currently selectable in Clank; they are in general selectable for Android apps, but with the caveats I listed in another comment. I'll be introducing selection of all devices in upcoming changes.

    Line 173, Patchset 1 (Latest): // When using streams with communication usage set, the output device is
    // automatically selected by the Android framework based on the input device.
    // Thus, there is no reason to expose an output device selection.
    Thomas Guilbert . unresolved

    Mirroring Dale's question, how should a user select between multiple output-only devices of the same type? I think we allow 2 BT devices to be connected at once, and some of these don't have microphones.

    I know this is an edge-case and might not need to be addressed now (we currently don't), but just something to keep in mind.

    Maya Jelonkiewicz

    If the device is output-only, it's not selectable at all, as there won't be a corresponding communication device for it.
    Android does allow multiple BT devices to be connected at once, but only one audio device ends up available for use by apps. That also goes for other types like USB. You are right though that this could change. We could definitely enhance the communication device-based audio management scheme to account for this case.

    Dale Curtis

    On windows the default and the default-communications device are separate things:
    https://source.chromium.org/chromium/chromium/src/+/main:media/audio/win/audio_manager_win.cc;l=176;drc=b4dcc60457a349c18efddcd6347cc4e8d27174ab

    Is there a reason to diverge here?

    Maya Jelonkiewicz

    This is a decision made 10 years ago. I wouldn't be opposed to changing it - possibly in a seperate CL?

    I assume you mean having a device with ID "communications" *instead of* one with ID "default"? My only potential concern would be if there is some part of Chrome that assumes there always is a "default" device [if the list is not empty]? Otherwise, that seems reasonable to me.

    Line 369, Patchset 1 (Latest): if (!SetCommunicationDevice(device_id)) {
    Dale Curtis . unresolved

    I believe on Windows we'd only do this if the device_id == default_communications.

    Maya Jelonkiewicz

    Sorry, not sure if I understand. Do you mean !=, i.e. we wouldn't call this for a default device? If so, it is because in that case we have custom logic to pick a default device (AudioDeviceSelector#selectDefaultDevice). This could also be worth considering changing.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Wed, 05 Mar 2025 13:57:08 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 5, 2025, 12:36:06 PM3/5/25
    to Maya Jelonkiewicz, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis added 4 comments

    Patchset-level comments
    Dale Curtis . unresolved

    I'm a bit concerned this is muddying the details around input-only device selection -- though it's possible that doesn't work on Android today.

    Maya Jelonkiewicz

    Could you elaborate on that? Unless the other comment thread covers this.

    Dale Curtis

    On other platforms communications devices specifically means a paired input/output device. It's possible to have standalone input and output devices. I'm trying to understand if this CL is diverging from that pattern or just bowing to Android's limitations. If the latter it needs a lot more comments on why we want to put communications in the name of things that should be more generic.

    Maya Jelonkiewicz

    I should underline first and foremost that this CL doesn't introduce behavior changes, just a refactor. I am following the existing implementation.

    We are indeed bowing to Android's limitations here. For one, on SDK < 29 we fallback to OpenSL ES, which doesn't expose per-stream device selection, so managing the system communication device is the only option to influence the device used by a stream. AFAIK Clank targets SDK 26+, and AAudio is also 26+, so we could perhaps drop OpenSL ES support, but there is also another reason - vendor devices may or may not respect per-stream device selection (e.g. they may route all streams with the same usage to one device, or exhibit clashes when using two seperate audio devices, and this might even happen silently). On the other hand, there is good support for the communication usage path, to allow for device selection in voice/video call apps. This is why the communication device-based approach for device selection is relevant and will need to stay around, even with per-stream device selection implemented.

    Dale Curtis

    It sounds like you're saying this should work with AAudio and compliant devices; of which I'd expect AL to be one?

    If that's the case, I don't think we should rename the classes, but I support renaming methods to make the limitations clearer relative to our ideals. I.e., somehwere down the line AudioDeviceSelector would work for non-communication devices -- which will be a long tail requirement for AL I'd expect.

    I'm a bit unclear on how this interacts with whatever value we pass to AAudio though. Is it the case that for a working AAudio impl we shouldn't call this at all and should only pass the device id to AAudio? I'd be more supportive of renaming the classes in this case since this is effectively just the fallback path for broken per-stream selection.

    File media/audio/android/audio_manager_android.cc
    Line 147, Patchset 1 (Latest): Java_AudioManagerAndroid_getCommunicationDeviceNames(
    Dale Curtis . resolved

    Is it not possible to have an input only device on Android?

    Maya Jelonkiewicz

    It is possible, but it won't be listed as a communication device (meaning it's only usable in Clank via the "default device" route).

    Dale Curtis

    I mean on other platforms this list is generally the list of all selectable devices, not just paired input/output communications devices. Given your other comments it sounds like these aren't selectable / listable though?

    Maya Jelonkiewicz

    Yes, specifically, they are not currently selectable in Clank; they are in general selectable for Android apps, but with the caveats I listed in another comment. I'll be introducing selection of all devices in upcoming changes.

    Dale Curtis

    Acknowledged

    Line 173, Patchset 1 (Latest): // When using streams with communication usage set, the output device is
    // automatically selected by the Android framework based on the input device.
    // Thus, there is no reason to expose an output device selection.
    Thomas Guilbert . unresolved

    Mirroring Dale's question, how should a user select between multiple output-only devices of the same type? I think we allow 2 BT devices to be connected at once, and some of these don't have microphones.

    I know this is an edge-case and might not need to be addressed now (we currently don't), but just something to keep in mind.

    Maya Jelonkiewicz

    If the device is output-only, it's not selectable at all, as there won't be a corresponding communication device for it.
    Android does allow multiple BT devices to be connected at once, but only one audio device ends up available for use by apps. That also goes for other types like USB. You are right though that this could change. We could definitely enhance the communication device-based audio management scheme to account for this case.

    Dale Curtis

    On windows the default and the default-communications device are separate things:
    https://source.chromium.org/chromium/chromium/src/+/main:media/audio/win/audio_manager_win.cc;l=176;drc=b4dcc60457a349c18efddcd6347cc4e8d27174ab

    Is there a reason to diverge here?

    Maya Jelonkiewicz

    This is a decision made 10 years ago. I wouldn't be opposed to changing it - possibly in a seperate CL?

    I assume you mean having a device with ID "communications" *instead of* one with ID "default"? My only potential concern would be if there is some part of Chrome that assumes there always is a "default" device [if the list is not empty]? Otherwise, that seems reasonable to me.

    Dale Curtis

    I'm inclined not to change it without strong reasons, since it'll result in surprises for developers / users.

    I think we always expect the default output device to work even if the list is entry, but I haven't audited all the managers to ensure they add a device there.

    Line 369, Patchset 1 (Latest): if (!SetCommunicationDevice(device_id)) {
    Dale Curtis . unresolved

    I believe on Windows we'd only do this if the device_id == default_communications.

    Maya Jelonkiewicz

    Sorry, not sure if I understand. Do you mean !=, i.e. we wouldn't call this for a default device? If so, it is because in that case we have custom logic to pick a default device (AudioDeviceSelector#selectDefaultDevice). This could also be worth considering changing.

    Dale Curtis

    Yeah for the default device I don't think we'd call anything, just let the output stream select whatever happens to be default. I think I misspoke though, on Windows we'd just tell the OS to create the default stream for role type "communications" when the device_id == default_communications.

    For explicit device_id we'd want to always set this as needed.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Wed, 05 Mar 2025 17:35:57 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 6, 2025, 8:26:13 AM3/6/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 2 comments

    Patchset-level comments
    Dale Curtis . unresolved

    I'm a bit concerned this is muddying the details around input-only device selection -- though it's possible that doesn't work on Android today.

    Maya Jelonkiewicz

    Could you elaborate on that? Unless the other comment thread covers this.

    Dale Curtis

    On other platforms communications devices specifically means a paired input/output device. It's possible to have standalone input and output devices. I'm trying to understand if this CL is diverging from that pattern or just bowing to Android's limitations. If the latter it needs a lot more comments on why we want to put communications in the name of things that should be more generic.

    Maya Jelonkiewicz

    I should underline first and foremost that this CL doesn't introduce behavior changes, just a refactor. I am following the existing implementation.

    We are indeed bowing to Android's limitations here. For one, on SDK < 29 we fallback to OpenSL ES, which doesn't expose per-stream device selection, so managing the system communication device is the only option to influence the device used by a stream. AFAIK Clank targets SDK 26+, and AAudio is also 26+, so we could perhaps drop OpenSL ES support, but there is also another reason - vendor devices may or may not respect per-stream device selection (e.g. they may route all streams with the same usage to one device, or exhibit clashes when using two seperate audio devices, and this might even happen silently). On the other hand, there is good support for the communication usage path, to allow for device selection in voice/video call apps. This is why the communication device-based approach for device selection is relevant and will need to stay around, even with per-stream device selection implemented.

    Dale Curtis

    It sounds like you're saying this should work with AAudio and compliant devices; of which I'd expect AL to be one?

    If that's the case, I don't think we should rename the classes, but I support renaming methods to make the limitations clearer relative to our ideals. I.e., somehwere down the line AudioDeviceSelector would work for non-communication devices -- which will be a long tail requirement for AL I'd expect.

    I'm a bit unclear on how this interacts with whatever value we pass to AAudio though. Is it the case that for a working AAudio impl we shouldn't call this at all and should only pass the device id to AAudio? I'd be more supportive of renaming the classes in this case since this is effectively just the fallback path for broken per-stream selection.

    Maya Jelonkiewicz

    I do expect that we won't be using the renamed classes for "proper" per-stream device selection. It is indeed mostly be a matter of passing the device ID to AAudio.

    The AudioDeviceListener I think is best replaced by a solution using AudioManager#registerAudioDeviceCallback (like https://crrev.com/c/6309250) - this automatically scales across various types of devices (incl. HDMI, which we don't even currently listen to changes for) and removes a dependency on the BT permission.

    The AudioDeviceSelector has logic relating to communication device management that I expect we shouldn't need (https://crrev.com/c/6299052). It also has inconvenient baggage from needing to support the older communication device APIs used in AudioDeviceSelectorPreS.

    (BTW: go/android-desktop-code?)

    File media/audio/android/audio_manager_android.cc
    Line 369, Patchset 1 (Latest): if (!SetCommunicationDevice(device_id)) {
    Dale Curtis . unresolved

    I believe on Windows we'd only do this if the device_id == default_communications.

    Maya Jelonkiewicz

    Sorry, not sure if I understand. Do you mean !=, i.e. we wouldn't call this for a default device? If so, it is because in that case we have custom logic to pick a default device (AudioDeviceSelector#selectDefaultDevice). This could also be worth considering changing.

    Dale Curtis

    Yeah for the default device I don't think we'd call anything, just let the output stream select whatever happens to be default. I think I misspoke though, on Windows we'd just tell the OS to create the default stream for role type "communications" when the device_id == default_communications.

    For explicit device_id we'd want to always set this as needed.

    Maya Jelonkiewicz

    What you describe does seem more logical. I don't think there is an explicit need to specify a communication device on Android; we should be able to use whatever the system decides by default just as on Windows.

    However, if you are concerned that changing how the default device is listed could be a surprising change, it could similarly be argued that changing this could be surprising - users may be accustomed to the selectDefaultDevice logic. IMO this is a matter to consider separately from this CL, if at all, though I can document the current behavior better.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Thu, 06 Mar 2025 13:26:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
    Comment-In-Reply-To: Maya Jelonkiewicz <mj...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 6, 2025, 12:44:22 PM3/6/25
    to Maya Jelonkiewicz, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis voted and added 3 comments

    Votes added by Dale Curtis

    Code-Review+1

    3 comments

    Patchset-level comments
    Dale Curtis . resolved

    I'm a bit concerned this is muddying the details around input-only device selection -- though it's possible that doesn't work on Android today.

    Maya Jelonkiewicz

    Could you elaborate on that? Unless the other comment thread covers this.

    Dale Curtis

    On other platforms communications devices specifically means a paired input/output device. It's possible to have standalone input and output devices. I'm trying to understand if this CL is diverging from that pattern or just bowing to Android's limitations. If the latter it needs a lot more comments on why we want to put communications in the name of things that should be more generic.

    Maya Jelonkiewicz

    I should underline first and foremost that this CL doesn't introduce behavior changes, just a refactor. I am following the existing implementation.

    We are indeed bowing to Android's limitations here. For one, on SDK < 29 we fallback to OpenSL ES, which doesn't expose per-stream device selection, so managing the system communication device is the only option to influence the device used by a stream. AFAIK Clank targets SDK 26+, and AAudio is also 26+, so we could perhaps drop OpenSL ES support, but there is also another reason - vendor devices may or may not respect per-stream device selection (e.g. they may route all streams with the same usage to one device, or exhibit clashes when using two seperate audio devices, and this might even happen silently). On the other hand, there is good support for the communication usage path, to allow for device selection in voice/video call apps. This is why the communication device-based approach for device selection is relevant and will need to stay around, even with per-stream device selection implemented.

    Dale Curtis

    It sounds like you're saying this should work with AAudio and compliant devices; of which I'd expect AL to be one?

    If that's the case, I don't think we should rename the classes, but I support renaming methods to make the limitations clearer relative to our ideals. I.e., somehwere down the line AudioDeviceSelector would work for non-communication devices -- which will be a long tail requirement for AL I'd expect.

    I'm a bit unclear on how this interacts with whatever value we pass to AAudio though. Is it the case that for a working AAudio impl we shouldn't call this at all and should only pass the device id to AAudio? I'd be more supportive of renaming the classes in this case since this is effectively just the fallback path for broken per-stream selection.

    Maya Jelonkiewicz

    I do expect that we won't be using the renamed classes for "proper" per-stream device selection. It is indeed mostly be a matter of passing the device ID to AAudio.

    The AudioDeviceListener I think is best replaced by a solution using AudioManager#registerAudioDeviceCallback (like https://crrev.com/c/6309250) - this automatically scales across various types of devices (incl. HDMI, which we don't even currently listen to changes for) and removes a dependency on the BT permission.

    The AudioDeviceSelector has logic relating to communication device management that I expect we shouldn't need (https://crrev.com/c/6299052). It also has inconvenient baggage from needing to support the older communication device APIs used in AudioDeviceSelectorPreS.

    (BTW: go/android-desktop-code?)

    Dale Curtis

    Okay, if this class is a workaround for cases where we can't properly set the device id, naming it around this sgtm. Thanks for the details.

    Dale Curtis . resolved

    Rename lgtm

    File media/audio/android/audio_manager_android.cc
    Line 369, Patchset 1 (Latest): if (!SetCommunicationDevice(device_id)) {
    Dale Curtis . unresolved

    I believe on Windows we'd only do this if the device_id == default_communications.

    Maya Jelonkiewicz

    Sorry, not sure if I understand. Do you mean !=, i.e. we wouldn't call this for a default device? If so, it is because in that case we have custom logic to pick a default device (AudioDeviceSelector#selectDefaultDevice). This could also be worth considering changing.

    Dale Curtis

    Yeah for the default device I don't think we'd call anything, just let the output stream select whatever happens to be default. I think I misspoke though, on Windows we'd just tell the OS to create the default stream for role type "communications" when the device_id == default_communications.

    For explicit device_id we'd want to always set this as needed.

    Maya Jelonkiewicz

    What you describe does seem more logical. I don't think there is an explicit need to specify a communication device on Android; we should be able to use whatever the system decides by default just as on Windows.

    However, if you are concerned that changing how the default device is listed could be a surprising change, it could similarly be argued that changing this could be surprising - users may be accustomed to the selectDefaultDevice logic. IMO this is a matter to consider separately from this CL, if at all, though I can document the current behavior better.

    Dale Curtis

    Changing how we list the devices could be an issue, but it's always hard to tell, especially on Android which doesn't have as large a tapestry of mweb RTC applications.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 1
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Thu, 06 Mar 2025 17:44:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 7, 2025, 7:13:01 AM3/7/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 2 comments

    File media/audio/android/audio_manager_android.cc
    Line 173, Patchset 1: // When using streams with communication usage set, the output device is

    // automatically selected by the Android framework based on the input device.
    // Thus, there is no reason to expose an output device selection.
    Thomas Guilbert . unresolved

    Mirroring Dale's question, how should a user select between multiple output-only devices of the same type? I think we allow 2 BT devices to be connected at once, and some of these don't have microphones.

    I know this is an edge-case and might not need to be addressed now (we currently don't), but just something to keep in mind.

    Maya Jelonkiewicz

    If the device is output-only, it's not selectable at all, as there won't be a corresponding communication device for it.
    Android does allow multiple BT devices to be connected at once, but only one audio device ends up available for use by apps. That also goes for other types like USB. You are right though that this could change. We could definitely enhance the communication device-based audio management scheme to account for this case.

    Dale Curtis

    On windows the default and the default-communications device are separate things:
    https://source.chromium.org/chromium/chromium/src/+/main:media/audio/win/audio_manager_win.cc;l=176;drc=b4dcc60457a349c18efddcd6347cc4e8d27174ab

    Is there a reason to diverge here?

    Maya Jelonkiewicz

    This is a decision made 10 years ago. I wouldn't be opposed to changing it - possibly in a seperate CL?

    I assume you mean having a device with ID "communications" *instead of* one with ID "default"? My only potential concern would be if there is some part of Chrome that assumes there always is a "default" device [if the list is not empty]? Otherwise, that seems reasonable to me.

    Dale Curtis

    I'm inclined not to change it without strong reasons, since it'll result in surprises for developers / users.

    I think we always expect the default output device to work even if the list is entry, but I haven't audited all the managers to ensure they add a device there.

    Maya Jelonkiewicz

    I reworded the comment to be a bit more clear, but other than that, I suppose we are not changing the behavior here? LMK if there is anything more to do here.

    Line 369, Patchset 1: if (!SetCommunicationDevice(device_id)) {
    Dale Curtis . unresolved

    I believe on Windows we'd only do this if the device_id == default_communications.

    Maya Jelonkiewicz

    Sorry, not sure if I understand. Do you mean !=, i.e. we wouldn't call this for a default device? If so, it is because in that case we have custom logic to pick a default device (AudioDeviceSelector#selectDefaultDevice). This could also be worth considering changing.

    Dale Curtis

    Yeah for the default device I don't think we'd call anything, just let the output stream select whatever happens to be default. I think I misspoke though, on Windows we'd just tell the OS to create the default stream for role type "communications" when the device_id == default_communications.

    For explicit device_id we'd want to always set this as needed.

    Maya Jelonkiewicz

    What you describe does seem more logical. I don't think there is an explicit need to specify a communication device on Android; we should be able to use whatever the system decides by default just as on Windows.

    However, if you are concerned that changing how the default device is listed could be a surprising change, it could similarly be argued that changing this could be surprising - users may be accustomed to the selectDefaultDevice logic. IMO this is a matter to consider separately from this CL, if at all, though I can document the current behavior better.

    Dale Curtis

    Changing how we list the devices could be an issue, but it's always hard to tell, especially on Android which doesn't have as large a tapestry of mweb RTC applications.

    Maya Jelonkiewicz

    In this case it would be the semantics of what the default device means that would change. But I assume the same applies.

    I clarified the default device behavior in the comment. LMK if there is anything more to do here.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 2
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Fri, 07 Mar 2025 12:12:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 10, 2025, 12:57:05 PM3/10/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 1 comment

    Patchset-level comments
    File-level comment, Patchset 2 (Latest):
    Maya Jelonkiewicz . resolved

    I see I have in fact made a mistake and flipped the semantics of communication devices - they are output devices for which an input device is automatically selected, rather than the other way around. I've been going along with how in Clank we expose communication devices as input devices, and did not correctly verify this fact. My apologies.

    This means that us listing communication devices as inputs and just providing a "default" for outputs is actually quite peculiar, and it should really be the other way around. I don't know if this is something worth changing at this point; while this is "backwards" internally, it's probably meaningless for the end user.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 2
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Mon, 10 Mar 2025 16:56:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 10, 2025, 12:57:57 PM3/10/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 1 comment

    Patchset-level comments
    Maya Jelonkiewicz . unresolved

    I see I have in fact made a mistake and flipped the semantics of communication devices - they are output devices for which an input device is automatically selected, rather than the other way around. I've been going along with how in Clank we expose communication devices as input devices, and did not correctly verify this fact. My apologies.

    This means that us listing communication devices as inputs and just providing a "default" for outputs is actually quite peculiar, and it should really be the other way around. I don't know if this is something worth changing at this point; while this is "backwards" internally, it's probably meaningless for the end user.

    Maya Jelonkiewicz

    Marking unresolved.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 2
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Mon, 10 Mar 2025 16:57:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Maya Jelonkiewicz <mj...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 10, 2025, 1:20:13 PM3/10/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 1 comment

    Patchset-level comments
    Maya Jelonkiewicz . unresolved

    I see I have in fact made a mistake and flipped the semantics of communication devices - they are output devices for which an input device is automatically selected, rather than the other way around. I've been going along with how in Clank we expose communication devices as input devices, and did not correctly verify this fact. My apologies.

    This means that us listing communication devices as inputs and just providing a "default" for outputs is actually quite peculiar, and it should really be the other way around. I don't know if this is something worth changing at this point; while this is "backwards" internally, it's probably meaningless for the end user.

    Maya Jelonkiewicz

    Marking unresolved.

    Maya Jelonkiewicz

    Patchset 3 addresses this, for now with the assumption that we won't change the behavior.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Mon, 10 Mar 2025 17:20:04 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 10, 2025, 3:48:20 PM3/10/25
    to Maya Jelonkiewicz, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis added 3 comments

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Line 173, Patchset 1: // When using streams with communication usage set, the output device is
    // automatically selected by the Android framework based on the input device.
    // Thus, there is no reason to expose an output device selection.
    Thomas Guilbert . resolved

    Mirroring Dale's question, how should a user select between multiple output-only devices of the same type? I think we allow 2 BT devices to be connected at once, and some of these don't have microphones.

    I know this is an edge-case and might not need to be addressed now (we currently don't), but just something to keep in mind.

    Maya Jelonkiewicz

    If the device is output-only, it's not selectable at all, as there won't be a corresponding communication device for it.
    Android does allow multiple BT devices to be connected at once, but only one audio device ends up available for use by apps. That also goes for other types like USB. You are right though that this could change. We could definitely enhance the communication device-based audio management scheme to account for this case.

    Dale Curtis

    On windows the default and the default-communications device are separate things:
    https://source.chromium.org/chromium/chromium/src/+/main:media/audio/win/audio_manager_win.cc;l=176;drc=b4dcc60457a349c18efddcd6347cc4e8d27174ab

    Is there a reason to diverge here?

    Maya Jelonkiewicz

    This is a decision made 10 years ago. I wouldn't be opposed to changing it - possibly in a seperate CL?

    I assume you mean having a device with ID "communications" *instead of* one with ID "default"? My only potential concern would be if there is some part of Chrome that assumes there always is a "default" device [if the list is not empty]? Otherwise, that seems reasonable to me.

    Dale Curtis

    I'm inclined not to change it without strong reasons, since it'll result in surprises for developers / users.

    I think we always expect the default output device to work even if the list is entry, but I haven't audited all the managers to ensure they add a device there.

    Maya Jelonkiewicz

    I reworded the comment to be a bit more clear, but other than that, I suppose we are not changing the behavior here? LMK if there is anything more to do here.

    Dale Curtis

    So long as we don't change behavior in this CL I don't have any issues with naming to make things more clear.

    Line 178, Patchset 3 (Latest): // selection to be made for the input device. Additionally, in order to
    Dale Curtis . unresolved

    As above, lets drop the preserving legacy behavior (which I don't think we want to preserve in cases where selecting devices actually works) and rephrase as a TODO(): Populate output device list.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Mon, 10 Mar 2025 19:48:11 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 11, 2025, 5:42:52 AM3/11/25
    to Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Maya Jelonkiewicz

    Per-stream device selection will change this, but we will need to preserve the current implementation (or at least some version of it), because of a) the OpenSL ES fallback for SDK < 29, and b) the lack of general support across all Android devices for arbitrarily routing to audio devices, which may cause surprises like no sound output or a different device being used than expected.

    I'm not saying we would *permanently* have this divergent implementation, but IMO we can't confidently get rid of communication stream based routing without a lot more work (at minimum testing across a multitude of devices).

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Tue, 11 Mar 2025 09:42:45 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 11, 2025, 12:30:32 PM3/11/25
    to Maya Jelonkiewicz, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Maya Jelonkiewicz

    Per-stream device selection will change this, but we will need to preserve the current implementation (or at least some version of it), because of a) the OpenSL ES fallback for SDK < 29, and b) the lack of general support across all Android devices for arbitrarily routing to audio devices, which may cause surprises like no sound output or a different device being used than expected.

    I'm not saying we would *permanently* have this divergent implementation, but IMO we can't confidently get rid of communication stream based routing without a lot more work (at minimum testing across a multitude of devices).

    Dale Curtis

    Do you think we could say that after a given Android version things would be expected to work properly?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Tue, 11 Mar 2025 16:30:23 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
    Comment-In-Reply-To: Maya Jelonkiewicz <mj...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 12, 2025, 6:35:38 AM3/12/25
    to Eliot Courtney, Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Maya Jelonkiewicz

    Per-stream device selection will change this, but we will need to preserve the current implementation (or at least some version of it), because of a) the OpenSL ES fallback for SDK < 29, and b) the lack of general support across all Android devices for arbitrarily routing to audio devices, which may cause surprises like no sound output or a different device being used than expected.

    I'm not saying we would *permanently* have this divergent implementation, but IMO we can't confidently get rid of communication stream based routing without a lot more work (at minimum testing across a multitude of devices).

    Dale Curtis

    Do you think we could say that after a given Android version things would be expected to work properly?

    Maya Jelonkiewicz

    Maybe in the future, but I don't think we could point to such a version right now. The Android team is leaning towards the opposite if anything - they discourage apps from selecting devices as opposed to just specifying a usage, even despite the existence of APIs to specify a device ID. At the same time that is counter to what we want for desktop 😕.

    I wouldn't be 100% opposed to launching this change on all Android devices, but erring on the side of caution, I'd have concerns that on some devices it would be an overall regression. The Android audio TL was pessimistic here, noting vendors may introduce limits on simultaneous device use, and that AAudio device selection can silently fail. How much of a problem this is in practice, I don't have good data on. We can discuss this over GVC.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Wed, 12 Mar 2025 10:35:31 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 12, 2025, 8:36:03 PM3/12/25
    to Maya Jelonkiewicz, Eliot Courtney, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Maya Jelonkiewicz

    Per-stream device selection will change this, but we will need to preserve the current implementation (or at least some version of it), because of a) the OpenSL ES fallback for SDK < 29, and b) the lack of general support across all Android devices for arbitrarily routing to audio devices, which may cause surprises like no sound output or a different device being used than expected.

    I'm not saying we would *permanently* have this divergent implementation, but IMO we can't confidently get rid of communication stream based routing without a lot more work (at minimum testing across a multitude of devices).

    Dale Curtis

    Do you think we could say that after a given Android version things would be expected to work properly?

    Maya Jelonkiewicz

    Maybe in the future, but I don't think we could point to such a version right now. The Android team is leaning towards the opposite if anything - they discourage apps from selecting devices as opposed to just specifying a usage, even despite the existence of APIs to specify a device ID. At the same time that is counter to what we want for desktop 😕.

    I wouldn't be 100% opposed to launching this change on all Android devices, but erring on the side of caution, I'd have concerns that on some devices it would be an overall regression. The Android audio TL was pessimistic here, noting vendors may introduce limits on simultaneous device use, and that AAudio device selection can silently fail. How much of a problem this is in practice, I don't have good data on. We can discuss this over GVC.

    Dale Curtis

    I chatted with Thomas and he seemed to think we are able to set the communications device previously. I'm not as familiar with this code, so am deferring to his knowledge here. I've setup a meeting for us all to sync tomorrow.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Thu, 13 Mar 2025 00:35:51 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 12, 2025, 9:05:12 PM3/12/25
    to Maya Jelonkiewicz, Eliot Courtney, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Maya Jelonkiewicz

    Per-stream device selection will change this, but we will need to preserve the current implementation (or at least some version of it), because of a) the OpenSL ES fallback for SDK < 29, and b) the lack of general support across all Android devices for arbitrarily routing to audio devices, which may cause surprises like no sound output or a different device being used than expected.

    I'm not saying we would *permanently* have this divergent implementation, but IMO we can't confidently get rid of communication stream based routing without a lot more work (at minimum testing across a multitude of devices).

    Dale Curtis

    Do you think we could say that after a given Android version things would be expected to work properly?

    Maya Jelonkiewicz

    Maybe in the future, but I don't think we could point to such a version right now. The Android team is leaning towards the opposite if anything - they discourage apps from selecting devices as opposed to just specifying a usage, even despite the existence of APIs to specify a device ID. At the same time that is counter to what we want for desktop 😕.

    I wouldn't be 100% opposed to launching this change on all Android devices, but erring on the side of caution, I'd have concerns that on some devices it would be an overall regression. The Android audio TL was pessimistic here, noting vendors may introduce limits on simultaneous device use, and that AAudio device selection can silently fail. How much of a problem this is in practice, I don't have good data on. We can discuss this over GVC.

    Dale Curtis

    I chatted with Thomas and he seemed to think we are able to set the communications device previously. I'm not as familiar with this code, so am deferring to his knowledge here. I've setup a meeting for us all to sync tomorrow.

    Dale Curtis

    Sorry that should read: "set non-communications devices"

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Thu, 13 Mar 2025 01:05:04 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Thomas Guilbert (Gerrit)

    unread,
    Mar 13, 2025, 12:24:09 AM3/13/25
    to Maya Jelonkiewicz, Eliot Courtney, Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz

    Thomas Guilbert added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Maya Jelonkiewicz

    Per-stream device selection will change this, but we will need to preserve the current implementation (or at least some version of it), because of a) the OpenSL ES fallback for SDK < 29, and b) the lack of general support across all Android devices for arbitrarily routing to audio devices, which may cause surprises like no sound output or a different device being used than expected.

    I'm not saying we would *permanently* have this divergent implementation, but IMO we can't confidently get rid of communication stream based routing without a lot more work (at minimum testing across a multitude of devices).

    Dale Curtis

    Do you think we could say that after a given Android version things would be expected to work properly?

    Maya Jelonkiewicz

    Maybe in the future, but I don't think we could point to such a version right now. The Android team is leaning towards the opposite if anything - they discourage apps from selecting devices as opposed to just specifying a usage, even despite the existence of APIs to specify a device ID. At the same time that is counter to what we want for desktop 😕.

    I wouldn't be 100% opposed to launching this change on all Android devices, but erring on the side of caution, I'd have concerns that on some devices it would be an overall regression. The Android audio TL was pessimistic here, noting vendors may introduce limits on simultaneous device use, and that AAudio device selection can silently fail. How much of a problem this is in practice, I don't have good data on. We can discuss this over GVC.

    Dale Curtis

    I chatted with Thomas and he seemed to think we are able to set the communications device previously. I'm not as familiar with this code, so am deferring to his knowledge here. I've setup a meeting for us all to sync tomorrow.

    Dale Curtis

    Sorry that should read: "set non-communications devices"

    Thomas Guilbert

    Pre-S, I think we only explicitly set BT and speakerphone, and use the default device for the rest, since [this code](https://source.chromium.org/chromium/chromium/src/+/main:media/base/android/java/src/org/chromium/media/AudioDeviceSelectorPreS.java;l=220;drc=f2db5409f4065feeb5525a59fea56cc48298d9db) doesn't do much. The default device is selected by the OS based on some internal scheme, which matches the [priorities outlined here](https://source.chromium.org/chromium/chromium/src/+/main:media/base/android/java/src/org/chromium/media/AudioDeviceSelectorPreS.java;l=95;drc=f2db5409f4065feeb5525a59fea56cc48298d9db) (I think...). I don't know if the Pre-S OS distinguishes whether these devices have a microphone (and are "communication devices") or are just outputs, and whether the "default" is re-selected when we turn communication mode on or off.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Thu, 13 Mar 2025 04:24:02 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 13, 2025, 6:18:22 AM3/13/25
    to Eliot Courtney, Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 1 comment

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3 (Latest): // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . unresolved

    I think this would be better phrased as a
    ```
    // TODO(bug): Currently this returns the list of output communication devices
    // since selecting individual devices doesn't work on many Android devices. We
    // are only able to reliably select communications devices.
    ```

    Since IIUC your follow up patch sets will fix this?

    Maya Jelonkiewicz

    Per-stream device selection will change this, but we will need to preserve the current implementation (or at least some version of it), because of a) the OpenSL ES fallback for SDK < 29, and b) the lack of general support across all Android devices for arbitrarily routing to audio devices, which may cause surprises like no sound output or a different device being used than expected.

    I'm not saying we would *permanently* have this divergent implementation, but IMO we can't confidently get rid of communication stream based routing without a lot more work (at minimum testing across a multitude of devices).

    Dale Curtis

    Do you think we could say that after a given Android version things would be expected to work properly?

    Maya Jelonkiewicz

    Maybe in the future, but I don't think we could point to such a version right now. The Android team is leaning towards the opposite if anything - they discourage apps from selecting devices as opposed to just specifying a usage, even despite the existence of APIs to specify a device ID. At the same time that is counter to what we want for desktop 😕.

    I wouldn't be 100% opposed to launching this change on all Android devices, but erring on the side of caution, I'd have concerns that on some devices it would be an overall regression. The Android audio TL was pessimistic here, noting vendors may introduce limits on simultaneous device use, and that AAudio device selection can silently fail. How much of a problem this is in practice, I don't have good data on. We can discuss this over GVC.

    Dale Curtis

    I chatted with Thomas and he seemed to think we are able to set the communications device previously. I'm not as familiar with this code, so am deferring to his knowledge here. I've setup a meeting for us all to sync tomorrow.

    Dale Curtis

    Sorry that should read: "set non-communications devices"

    Thomas Guilbert

    Pre-S, I think we only explicitly set BT and speakerphone, and use the default device for the rest, since [this code](https://source.chromium.org/chromium/chromium/src/+/main:media/base/android/java/src/org/chromium/media/AudioDeviceSelectorPreS.java;l=220;drc=f2db5409f4065feeb5525a59fea56cc48298d9db) doesn't do much. The default device is selected by the OS based on some internal scheme, which matches the [priorities outlined here](https://source.chromium.org/chromium/chromium/src/+/main:media/base/android/java/src/org/chromium/media/AudioDeviceSelectorPreS.java;l=95;drc=f2db5409f4065feeb5525a59fea56cc48298d9db) (I think...). I don't know if the Pre-S OS distinguishes whether these devices have a microphone (and are "communication devices") or are just outputs, and whether the "default" is re-selected when we turn communication mode on or off.

    Maya Jelonkiewicz

    I'm also not sure fully sure how the deprecated calls on pre-S behave, but they don't seem to be providing anything more than setCommunicationDevice.

    Following my correction about communication devices being output devices, I've been able to find an output-only device and find that it *is* possible to select an output device without an associated mic via setCommunicationDevice. In this case the system selects some other mic for input communication streams. But standalone mics or combinations like builtin mic in + headset out are not selectable for communication streams.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Thu, 13 Mar 2025 10:18:13 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Thomas Guilbert (Gerrit)

    unread,
    Mar 13, 2025, 5:51:37 PM3/13/25
    to Maya Jelonkiewicz, Eliot Courtney, Dale Curtis, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Maya Jelonkiewicz

    Thomas Guilbert added 7 comments

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

    Thanks again for meeting earlier. Here's some proposed changes, based on my current understanding (which has been greatly updated over the course of this CL and this discussion), so please push-back on anything that doesn't seem right.

    File media/audio/android/audio_manager_android.cc
    Thomas Guilbert

    I propose the following comment:

    ```
    Android doesn't allow control over setting an individual input and output
    device, and forces us to set a single device with an input/output pair
    (a.k.a. a "communication device").
    The names we receive below are enums abstracting the exact model names and
    device IDs (e.g. "BT Headset" instead of "FooBuds Pro 2.0").
    On Android S+, these should be proper communication devices, with an
    associated input.
    On Android R-, these devices could *potentially* be output only, but it's
    not clear wether this is a real issue, considering how long this code has
    been around for...
    TODO(bug): Expose specific model names here, and allow per-stream device input selection.
    ```

    Line 178, Patchset 3 (Latest): // selection to be made for the input device. Additionally, in order to
    Dale Curtis . unresolved

    As above, lets drop the preserving legacy behavior (which I don't think we want to preserve in cases where selecting devices actually works) and rephrase as a TODO(): Populate output device list.

    Thomas Guilbert

    Proposed comment:
    ```
    Android doesn't allow control over setting an individual input and output
    device, and forces us to set a single device with an input/output pair
    (a.k.a. a "communication device").
    We've only returned "default" here for quite some time, forcing output
    device selection to happen through selecting the system-wide input
    device (see `GetAudioInputDeviceNames()`).
    Setting the output via the input device is backwards, and could be updated.
    However, only returning "default" here has prevented confusion for users:
    populating this list would've given users the option to set a different input
    and output devices, which would've failed.
    TODO(bug): populate `device_names` with the real list of output devices
    and allow per-stream device selection.
    ```

    File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java
    Line 268, Patchset 3 (Latest): private AudioDeviceName @Nullable [] getCommunicationDeviceNames() {
    Thomas Guilbert . unresolved

    This returns the "synthetic" names, which might not be "communication" devices on Pre-S. I would consider renaming this function to `getConnectedDeviceNames()`, `getAvailableDeviceNames()`, or `getGenericDeviceNames()`, then also mention that the specific device model names are replaced with a generic name for that category.

    File media/base/android/java/src/org/chromium/media/CommunicationDeviceListener.java
    Line 34, Patchset 3 (Latest):class CommunicationDeviceListener {
    Thomas Guilbert . unresolved

    I would advocate for leaving this class as the AudioDeviceListener, since it can listen for output-only devices IIUC.

    If `OnCommunicationDeviceChangedListener()` is used for S+, we could simplify the S+ code to no longer depend on this class, or then create a "proper" `CommunicationDeviceListener`.

    File media/base/android/java/src/org/chromium/media/CommunicationDeviceSelector.java
    Line 16, Patchset 3 (Latest):abstract class CommunicationDeviceSelector {
    Thomas Guilbert . unresolved

    Could you add a comment mentioning that a communication device is a device with paired input/ouput.

    File media/base/android/java/src/org/chromium/media/CommunicationDeviceSelectorPreS.java
    Line 19, Patchset 3 (Latest):class CommunicationDeviceSelectorPreS extends CommunicationDeviceSelector {
    Thomas Guilbert . unresolved

    Could you add a comment mentioning that Pre-S, there isn't the concept of "communication device", but device selection effectively behaves the same way, and is emulated by this class? E.g., selecting a device forces the OS to select both the input and the output at once.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Maya Jelonkiewicz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Thu, 13 Mar 2025 21:51:11 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 14, 2025, 2:54:17 PM3/14/25
    to Maya Jelonkiewicz, Eliot Courtney, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz

    Dale Curtis voted and added 1 comment

    Votes added by Dale Curtis

    Code-Review+1

    1 comment

    Patchset-level comments
    Dale Curtis . resolved

    Defer to Thomas for approval, but lgtm generally

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Fri, 14 Mar 2025 18:54:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 21, 2025, 10:14:07 AM3/21/25
    to Dale Curtis, Eliot Courtney, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Thomas Guilbert

    Maya Jelonkiewicz added 1 comment

    File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java
    Line 268, Patchset 3 (Latest): private AudioDeviceName @Nullable [] getCommunicationDeviceNames() {
    Thomas Guilbert . unresolved

    This returns the "synthetic" names, which might not be "communication" devices on Pre-S. I would consider renaming this function to `getConnectedDeviceNames()`, `getAvailableDeviceNames()`, or `getGenericDeviceNames()`, then also mention that the specific device model names are replaced with a generic name for that category.

    Maya Jelonkiewicz

    Hmm, I'd be concerned that introducing a new name on top of this may be redundant complexity. From one perspective, pre-S is "simulating" post-S communication device management, and in the end, both sets of APIs are controlling which device is meant to be used for communication-usage streams.

    Alternatively, if we change it here, I guess we'd want to change it everywhere else that is relevant to match? "Generic device" seems fair to me, or maybe indeed "synthetic device".

    The "Name(s)" part is misleading, for sure. AudioDeviceName wraps a name and an ID, and for per-stream device selection we will probably also store other device metadata there, like the device type. This probably stemmed from `media::AudioDeviceName`, which is also a container for name & ID.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 3
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Fri, 21 Mar 2025 14:13:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Thomas Guilbert <tgui...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 21, 2025, 12:06:43 PM3/21/25
    to Dale Curtis, Eliot Courtney, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 4 comments

    File media/audio/android/audio_manager_android.cc
    Line 369, Patchset 1: if (!SetCommunicationDevice(device_id)) {
    Dale Curtis . resolved

    I believe on Windows we'd only do this if the device_id == default_communications.

    Maya Jelonkiewicz

    Sorry, not sure if I understand. Do you mean !=, i.e. we wouldn't call this for a default device? If so, it is because in that case we have custom logic to pick a default device (AudioDeviceSelector#selectDefaultDevice). This could also be worth considering changing.

    Dale Curtis

    Yeah for the default device I don't think we'd call anything, just let the output stream select whatever happens to be default. I think I misspoke though, on Windows we'd just tell the OS to create the default stream for role type "communications" when the device_id == default_communications.

    For explicit device_id we'd want to always set this as needed.

    Maya Jelonkiewicz

    What you describe does seem more logical. I don't think there is an explicit need to specify a communication device on Android; we should be able to use whatever the system decides by default just as on Windows.

    However, if you are concerned that changing how the default device is listed could be a surprising change, it could similarly be argued that changing this could be surprising - users may be accustomed to the selectDefaultDevice logic. IMO this is a matter to consider separately from this CL, if at all, though I can document the current behavior better.

    Dale Curtis

    Changing how we list the devices could be an issue, but it's always hard to tell, especially on Android which doesn't have as large a tapestry of mweb RTC applications.

    Maya Jelonkiewicz

    In this case it would be the semantics of what the default device means that would change. But I assume the same applies.

    I clarified the default device behavior in the comment. LMK if there is anything more to do here.

    Maya Jelonkiewicz

    Done

    File media/base/android/java/src/org/chromium/media/CommunicationDeviceListener.java
    Line 34, Patchset 3:class CommunicationDeviceListener {
    Thomas Guilbert . unresolved

    I would advocate for leaving this class as the AudioDeviceListener, since it can listen for output-only devices IIUC.

    If `OnCommunicationDeviceChangedListener()` is used for S+, we could simplify the S+ code to no longer depend on this class, or then create a "proper" `CommunicationDeviceListener`.

    Maya Jelonkiewicz

    I do believe this attempts to restrict to communication devices (e.g. for BT we check for a device with a "HEADSET" profile, but not "A2DP"). This class is also only ever used by CommunicationDeviceSelector(AudioDeviceSelector), with the sole purpose of keeping mDeviceStates up to date.

    File media/base/android/java/src/org/chromium/media/CommunicationDeviceSelector.java
    Line 16, Patchset 3:abstract class CommunicationDeviceSelector {
    Thomas Guilbert . resolved

    Could you add a comment mentioning that a communication device is a device with paired input/ouput.

    Maya Jelonkiewicz

    Done

    File media/base/android/java/src/org/chromium/media/CommunicationDeviceSelectorPreS.java
    Line 19, Patchset 3:class CommunicationDeviceSelectorPreS extends CommunicationDeviceSelector {
    Thomas Guilbert . resolved

    Could you add a comment mentioning that Pre-S, there isn't the concept of "communication device", but device selection effectively behaves the same way, and is emulated by this class? E.g., selecting a device forces the OS to select both the input and the output at once.

    Maya Jelonkiewicz

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 4
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Fri, 21 Mar 2025 16:06:25 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 21, 2025, 12:07:58 PM3/21/25
    to Dale Curtis, Eliot Courtney, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Dale Curtis and Thomas Guilbert

    Maya Jelonkiewicz added 3 comments

    Patchset-level comments
    File-level comment, Patchset 2:
    Maya Jelonkiewicz . resolved

    I see I have in fact made a mistake and flipped the semantics of communication devices - they are output devices for which an input device is automatically selected, rather than the other way around. I've been going along with how in Clank we expose communication devices as input devices, and did not correctly verify this fact. My apologies.

    This means that us listing communication devices as inputs and just providing a "default" for outputs is actually quite peculiar, and it should really be the other way around. I don't know if this is something worth changing at this point; while this is "backwards" internally, it's probably meaningless for the end user.

    Maya Jelonkiewicz

    Marking unresolved.

    Maya Jelonkiewicz

    Patchset 3 addresses this, for now with the assumption that we won't change the behavior.

    Maya Jelonkiewicz

    Done

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3: // meant to return input devices, this is inverted for compatibility with
    Maya Jelonkiewicz

    Changed based on suggestion.

    Line 178, Patchset 3: // selection to be made for the input device. Additionally, in order to
    Dale Curtis . unresolved

    As above, lets drop the preserving legacy behavior (which I don't think we want to preserve in cases where selecting devices actually works) and rephrase as a TODO(): Populate output device list.

    Thomas Guilbert

    Proposed comment:
    ```
    Android doesn't allow control over setting an individual input and output
    device, and forces us to set a single device with an input/output pair
    (a.k.a. a "communication device").
    We've only returned "default" here for quite some time, forcing output
    device selection to happen through selecting the system-wide input
    device (see `GetAudioInputDeviceNames()`).
    Setting the output via the input device is backwards, and could be updated.
    However, only returning "default" here has prevented confusion for users:
    populating this list would've given users the option to set a different input
    and output devices, which would've failed.
    TODO(bug): populate `device_names` with the real list of output devices
    and allow per-stream device selection.
    ```

    Maya Jelonkiewicz

    Changed based on suggestion.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 4
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Comment-Date: Fri, 21 Mar 2025 16:07:36 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 21, 2025, 1:21:16 PM3/21/25
    to Maya Jelonkiewicz, Eliot Courtney, Thomas Guilbert, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz and Thomas Guilbert

    Dale Curtis voted and added 1 comment

    Votes added by Dale Curtis

    Code-Review+1

    1 comment

    Patchset-level comments
    File-level comment, Patchset 4 (Latest):
    Dale Curtis . resolved

    Still lgtm, but defer to Thomas.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    • Thomas Guilbert
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 4
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Fri, 21 Mar 2025 17:20:46 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Thomas Guilbert (Gerrit)

    unread,
    Mar 23, 2025, 9:08:49 PM3/23/25
    to Maya Jelonkiewicz, Thomas Guilbert, Dale Curtis, Eliot Courtney, chromium...@chromium.org, feature-me...@chromium.org
    Attention needed from Maya Jelonkiewicz

    Thomas Guilbert voted and added 5 comments

    Votes added by Thomas Guilbert

    Code-Review+1

    5 comments

    Patchset-level comments
    Thomas Guilbert . resolved

    LGTM! Thank you for your patience, and apologies for the bikeshedding... Future reviews should be more streamlined 🙏

    File media/audio/android/audio_manager_android.cc
    Line 145, Patchset 3: // meant to return input devices, this is inverted for compatibility with
    Dale Curtis . resolved
    Thomas Guilbert

    Thanks!

    Line 178, Patchset 3: // selection to be made for the input device. Additionally, in order to
    Dale Curtis . resolved

    As above, lets drop the preserving legacy behavior (which I don't think we want to preserve in cases where selecting devices actually works) and rephrase as a TODO(): Populate output device list.

    Thomas Guilbert

    Proposed comment:
    ```
    Android doesn't allow control over setting an individual input and output
    device, and forces us to set a single device with an input/output pair
    (a.k.a. a "communication device").
    We've only returned "default" here for quite some time, forcing output
    device selection to happen through selecting the system-wide input
    device (see `GetAudioInputDeviceNames()`).
    Setting the output via the input device is backwards, and could be updated.
    However, only returning "default" here has prevented confusion for users:
    populating this list would've given users the option to set a different input
    and output devices, which would've failed.
    TODO(bug): populate `device_names` with the real list of output devices
    and allow per-stream device selection.
    ```

    Maya Jelonkiewicz

    Changed based on suggestion.

    Thomas Guilbert

    Thanks!

    File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java
    Line 268, Patchset 3: private AudioDeviceName @Nullable [] getCommunicationDeviceNames() {
    Thomas Guilbert . resolved

    This returns the "synthetic" names, which might not be "communication" devices on Pre-S. I would consider renaming this function to `getConnectedDeviceNames()`, `getAvailableDeviceNames()`, or `getGenericDeviceNames()`, then also mention that the specific device model names are replaced with a generic name for that category.

    Maya Jelonkiewicz

    Hmm, I'd be concerned that introducing a new name on top of this may be redundant complexity. From one perspective, pre-S is "simulating" post-S communication device management, and in the end, both sets of APIs are controlling which device is meant to be used for communication-usage streams.

    Alternatively, if we change it here, I guess we'd want to change it everywhere else that is relevant to match? "Generic device" seems fair to me, or maybe indeed "synthetic device".

    The "Name(s)" part is misleading, for sure. AudioDeviceName wraps a name and an ID, and for per-stream device selection we will probably also store other device metadata there, like the device type. This probably stemmed from `media::AudioDeviceName`, which is also a container for name & ID.

    Thomas Guilbert

    Ok for not introducing a new term, and using communication device across the board. Dropping the "name" also SGTM.

    File media/base/android/java/src/org/chromium/media/CommunicationDeviceListener.java
    Line 34, Patchset 3:class CommunicationDeviceListener {
    Thomas Guilbert . resolved

    I would advocate for leaving this class as the AudioDeviceListener, since it can listen for output-only devices IIUC.

    If `OnCommunicationDeviceChangedListener()` is used for S+, we could simplify the S+ code to no longer depend on this class, or then create a "proper" `CommunicationDeviceListener`.

    Maya Jelonkiewicz

    I do believe this attempts to restrict to communication devices (e.g. for BT we check for a device with a "HEADSET" profile, but not "A2DP"). This class is also only ever used by CommunicationDeviceSelector(AudioDeviceSelector), with the sole purpose of keeping mDeviceStates up to date.

    Thomas Guilbert

    Ok for leaving it as is then.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Maya Jelonkiewicz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 4
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Attention: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Comment-Date: Mon, 24 Mar 2025 01:08:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 24, 2025, 7:10:24 AM3/24/25
    to Thomas Guilbert, Dale Curtis, Eliot Courtney, chromium...@chromium.org, feature-me...@chromium.org

    Maya Jelonkiewicz added 1 comment

    Patchset-level comments
    Thomas Guilbert . resolved

    LGTM! Thank you for your patience, and apologies for the bikeshedding... Future reviews should be more streamlined 🙏

    Maya Jelonkiewicz

    No worries, if there are issues worth discussing let's not brush them aside.

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 4
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Comment-Date: Mon, 24 Mar 2025 11:10:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Thomas Guilbert <tgui...@chromium.org>
    satisfied_requirement
    open
    diffy

    Maya Jelonkiewicz (Gerrit)

    unread,
    Mar 24, 2025, 7:10:26 AM3/24/25
    to Thomas Guilbert, Dale Curtis, Eliot Courtney, chromium...@chromium.org, feature-me...@chromium.org

    Maya Jelonkiewicz voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 4
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Thomas Guilbert <tgui...@chromium.org>
    Gerrit-CC: Eliot Courtney <edcou...@chromium.org>
    Gerrit-Comment-Date: Mon, 24 Mar 2025 11:10:14 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Mar 24, 2025, 7:56:24 AM3/24/25
    to Maya Jelonkiewicz, Thomas Guilbert, Dale Curtis, Eliot Courtney, chromium...@chromium.org, feature-me...@chromium.org

    Chromium LUCI CQ submitted the change

    Change information

    Commit message:
    Refactor Android audio code to clarify use of communication devices

    This change renames classes and methods to make it clearer when they use
    and/or manage the system communication device. This should make the
    current implementation more transparent and prepares the code for a
    future modification that allows for per-stream device selection as
    opposed to using the current communication device for streams.
    Bug: 399861696
    Change-Id: I776fe6c57ed926e33293998d800400768a1e4833
    Commit-Queue: Maya Jelonkiewicz <mj...@google.com>
    Reviewed-by: Thomas Guilbert <tgui...@chromium.org>
    Reviewed-by: Dale Curtis <dalec...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1436764}
    Files:
    • M media/audio/android/audio_manager_android.cc
    • M media/audio/android/audio_manager_android.h
    • M media/base/android/BUILD.gn
    • M media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java
    • R media/base/android/java/src/org/chromium/media/CommunicationDeviceListener.java
    • R media/base/android/java/src/org/chromium/media/CommunicationDeviceSelector.java
    • R media/base/android/java/src/org/chromium/media/CommunicationDeviceSelectorPostS.java
    • R media/base/android/java/src/org/chromium/media/CommunicationDeviceSelectorPreS.java
    • R media/base/android/java/src/test/org/chromium/media/CommunicationDeviceListenerTest.java
    Change size: L
    Delta: 9 files changed, 180 insertions(+), 118 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Thomas Guilbert, +1 by Dale Curtis
    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: I776fe6c57ed926e33293998d800400768a1e4833
    Gerrit-Change-Number: 6316647
    Gerrit-PatchSet: 5
    Gerrit-Owner: Maya Jelonkiewicz <mj...@google.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages