Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Unified Diff: media/audio/mac/audio_manager_mac.cc

Issue 2721633005: Fix zero channel count being returned for unknown macOS layouts. (Closed)
Patch Set: Zero intialize. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_manager_mac.cc
diff --git a/media/audio/mac/audio_manager_mac.cc b/media/audio/mac/audio_manager_mac.cc
index 436d4ee77bcb3e6fb2413de73e3b68b053a5357f..cb2ac1f1f2f7b8fce551096508bcafee56560f7c 100644
--- a/media/audio/mac/audio_manager_mac.cc
+++ b/media/audio/mac/audio_manager_mac.cc
@@ -447,8 +447,10 @@ bool AudioManagerMac::GetDeviceChannels(AudioDeviceID device,
// only return up to 8 channels in any layout. To allow WebAudio to work with
// > 8 channel devices, we must use the total channel count instead of the
// channel count of the preferred layout.
- if (GetDeviceTotalChannelCount(device, scope, channels) &&
- *channels > kMaxConcurrentChannels) {
+ int total_channel_count = 0;
+ if (GetDeviceTotalChannelCount(device, scope, &total_channel_count) &&
+ total_channel_count > kMaxConcurrentChannels) {
+ *channels = total_channel_count;
return true;
}
@@ -510,6 +512,12 @@ bool AudioManagerMac::GetDeviceChannels(AudioDeviceID device,
}
}
+ // If we still don't have a channel count, fall back to total channel count.
+ if (*channels == 0) {
+ DLOG(WARNING) << "Unable to use channel layout for channel count.";
+ *channels = total_channel_count;
+ }
+
DVLOG(1) << (scope == kAudioDevicePropertyScopeInput ? "Input" : "Output")
<< " channels: " << *channels;
return true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698