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

Unified Diff: audio_low_latency_output_win.cc

Issue 11408002: Make channel mixing checks explicit. (Closed) Base URL: svn://chrome-svn/chrome/branches/1271/src/media/audio/win/
Patch Set: Created 8 years, 1 month 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: audio_low_latency_output_win.cc
===================================================================
--- audio_low_latency_output_win.cc (revision 166575)
+++ audio_low_latency_output_win.cc (working copy)
@@ -375,6 +375,16 @@
return 0;
}
+static bool ChannelMixingSupported(int bytes_per_sample, int in_channels,
+ int out_channels) {
+ return bytes_per_sample == 2 &&
+ ((in_channels == 1 && out_channels == 2) ||
+ (in_channels == 1 && out_channels == 8) ||
+ (in_channels == 2 && out_channels == 6) ||
+ (in_channels == 2 && out_channels == 8) ||
+ (in_channels == 2 && out_channels == 1));
+}
+
// static
AUDCLNT_SHAREMODE WASAPIAudioOutputStream::GetShareMode() {
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
@@ -493,23 +503,15 @@
if (opened_)
return true;
- // Down-mixing is currently not supported. The number of channels provided
- // by the audio source must be less than or equal to the number of native
- // channels (given by endpoint_channel_count()) which is the channel count
- // used when opening the default endpoint device.
- if (channel_factor() < 1 && channel_factor() != 0.5f) {
- LOG(ERROR) << "Channel down-mixing is not supported";
+ if (format_.Format.nChannels != client_channel_count_ &&
henrika (OOO until Aug 14) 2012/11/08 08:27:42 We could perhaps keep some comments. You removed t
DaleCurtis 2012/11/08 18:39:30 The old ones are out of date and the LOG(ERROR) ex
+ !ChannelMixingSupported(
+ format_.Format.wBitsPerSample / 8, client_channel_count_,
+ format_.Format.nChannels)) {
+ LOG(ERROR) << "Channel mixing is not supported.";
RecordFallbackStats();
return false;
}
- // Only 16-bit audio is supported in combination with channel up-mixing.
- if (channel_factor() > 1 && (format_.Format.wBitsPerSample != 16)) {
- LOG(ERROR) << "16-bit audio is required when channel up-mixing is active.";
- RecordFallbackStats();
- return false;
- }
-
// Create an IMMDeviceEnumerator interface and obtain a reference to
// the IMMDevice interface of the default rendering device with the
// specified role.
« 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