Commit 041040af authored by grunell's avatar grunell Committed by Commit bot

Switch to keyboard mic layout for WebRTC if conditions are met.

Conditions:
* Track processing is enabled.
* Experimental constraint is set.
* Keyboard mic is supported (reported via effect).
* The ordinary layout is stereo.

This CL will be landed last of the keyboard mic support CLs.

BUG=345296

Review URL: https://codereview.chromium.org/598563002

Cr-Commit-Position: refs/heads/master@{#296689}
parent 9494bfe3
...@@ -156,6 +156,24 @@ bool WebRtcAudioCapturer::Initialize() { ...@@ -156,6 +156,24 @@ bool WebRtcAudioCapturer::Initialize() {
media::ChannelLayout channel_layout = static_cast<media::ChannelLayout>( media::ChannelLayout channel_layout = static_cast<media::ChannelLayout>(
device_info_.device.input.channel_layout); device_info_.device.input.channel_layout);
// If KEYBOARD_MIC effect is set, change the layout to the corresponding
// layout that includes the keyboard mic.
if ((device_info_.device.input.effects &
media::AudioParameters::KEYBOARD_MIC) &&
MediaStreamAudioProcessor::IsAudioTrackProcessingEnabled() &&
audio_constraints.GetProperty(
MediaAudioConstraints::kGoogExperimentalNoiseSuppression)) {
if (channel_layout == media::CHANNEL_LAYOUT_STEREO) {
channel_layout = media::CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC;
DVLOG(1) << "Changed stereo layout to stereo + keyboard mic layout due "
<< "to KEYBOARD_MIC effect.";
} else {
DVLOG(1) << "KEYBOARD_MIC effect ignored, not compatible with layout "
<< channel_layout;
}
}
DVLOG(1) << "Audio input hardware channel layout: " << channel_layout; DVLOG(1) << "Audio input hardware channel layout: " << channel_layout;
UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioInputChannelLayout", UMA_HISTOGRAM_ENUMERATION("WebRTC.AudioInputChannelLayout",
channel_layout, media::CHANNEL_LAYOUT_MAX + 1); channel_layout, media::CHANNEL_LAYOUT_MAX + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment