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

Side by Side Diff: media/audio/win/core_audio_util_win.cc

Issue 2699463002: Merge M57: "Always return CHANNEL_LAYOUT_UNSUPPORTED for unsupported layouts." (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/win/core_audio_util_win.h" 5 #include "media/audio/win/core_audio_util_win.h"
6 6
7 #include <devicetopology.h> 7 #include <devicetopology.h>
8 #include <dxdiag.h> 8 #include <dxdiag.h>
9 #include <functiondiscoverykeys_devpkey.h> 9 #include <functiondiscoverykeys_devpkey.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 27 matching lines...) Expand all
38 // Converts Microsoft's channel configuration to ChannelLayout. 38 // Converts Microsoft's channel configuration to ChannelLayout.
39 // This mapping is not perfect but the best we can do given the current 39 // This mapping is not perfect but the best we can do given the current
40 // ChannelLayout enumerator and the Windows-specific speaker configurations 40 // ChannelLayout enumerator and the Windows-specific speaker configurations
41 // defined in ksmedia.h. Don't assume that the channel ordering in 41 // defined in ksmedia.h. Don't assume that the channel ordering in
42 // ChannelLayout is exactly the same as the Windows specific configuration. 42 // ChannelLayout is exactly the same as the Windows specific configuration.
43 // As an example: KSAUDIO_SPEAKER_7POINT1_SURROUND is mapped to 43 // As an example: KSAUDIO_SPEAKER_7POINT1_SURROUND is mapped to
44 // CHANNEL_LAYOUT_7_1 but the positions of Back L, Back R and Side L, Side R 44 // CHANNEL_LAYOUT_7_1 but the positions of Back L, Back R and Side L, Side R
45 // speakers are different in these two definitions. 45 // speakers are different in these two definitions.
46 static ChannelLayout ChannelConfigToChannelLayout(ChannelConfig config) { 46 static ChannelLayout ChannelConfigToChannelLayout(ChannelConfig config) {
47 switch (config) { 47 switch (config) {
48 case KSAUDIO_SPEAKER_DIRECTOUT:
49 DVLOG(2) << "KSAUDIO_SPEAKER_DIRECTOUT=>CHANNEL_LAYOUT_NONE";
50 return CHANNEL_LAYOUT_NONE;
51 case KSAUDIO_SPEAKER_MONO: 48 case KSAUDIO_SPEAKER_MONO:
52 DVLOG(2) << "KSAUDIO_SPEAKER_MONO=>CHANNEL_LAYOUT_MONO"; 49 DVLOG(2) << "KSAUDIO_SPEAKER_MONO=>CHANNEL_LAYOUT_MONO";
53 return CHANNEL_LAYOUT_MONO; 50 return CHANNEL_LAYOUT_MONO;
54 case KSAUDIO_SPEAKER_STEREO: 51 case KSAUDIO_SPEAKER_STEREO:
55 DVLOG(2) << "KSAUDIO_SPEAKER_STEREO=>CHANNEL_LAYOUT_STEREO"; 52 DVLOG(2) << "KSAUDIO_SPEAKER_STEREO=>CHANNEL_LAYOUT_STEREO";
56 return CHANNEL_LAYOUT_STEREO; 53 return CHANNEL_LAYOUT_STEREO;
57 case KSAUDIO_SPEAKER_QUAD: 54 case KSAUDIO_SPEAKER_QUAD:
58 DVLOG(2) << "KSAUDIO_SPEAKER_QUAD=>CHANNEL_LAYOUT_QUAD"; 55 DVLOG(2) << "KSAUDIO_SPEAKER_QUAD=>CHANNEL_LAYOUT_QUAD";
59 return CHANNEL_LAYOUT_QUAD; 56 return CHANNEL_LAYOUT_QUAD;
60 case KSAUDIO_SPEAKER_SURROUND: 57 case KSAUDIO_SPEAKER_SURROUND:
(...skipping 13 matching lines...) Expand all
74 return CHANNEL_LAYOUT_7_1; 71 return CHANNEL_LAYOUT_7_1;
75 default: 72 default:
76 DVLOG(2) << "Unsupported channel configuration: " << config; 73 DVLOG(2) << "Unsupported channel configuration: " << config;
77 return CHANNEL_LAYOUT_UNSUPPORTED; 74 return CHANNEL_LAYOUT_UNSUPPORTED;
78 } 75 }
79 } 76 }
80 77
81 // TODO(henrika): add mapping for all types in the ChannelLayout enumerator. 78 // TODO(henrika): add mapping for all types in the ChannelLayout enumerator.
82 static ChannelConfig ChannelLayoutToChannelConfig(ChannelLayout layout) { 79 static ChannelConfig ChannelLayoutToChannelConfig(ChannelLayout layout) {
83 switch (layout) { 80 switch (layout) {
84 case CHANNEL_LAYOUT_NONE:
85 DVLOG(2) << "CHANNEL_LAYOUT_NONE=>KSAUDIO_SPEAKER_UNSUPPORTED";
86 return KSAUDIO_SPEAKER_UNSUPPORTED;
87 case CHANNEL_LAYOUT_UNSUPPORTED:
88 DVLOG(2) << "CHANNEL_LAYOUT_UNSUPPORTED=>KSAUDIO_SPEAKER_UNSUPPORTED";
89 return KSAUDIO_SPEAKER_UNSUPPORTED;
90 case CHANNEL_LAYOUT_MONO: 81 case CHANNEL_LAYOUT_MONO:
91 DVLOG(2) << "CHANNEL_LAYOUT_MONO=>KSAUDIO_SPEAKER_MONO"; 82 DVLOG(2) << "CHANNEL_LAYOUT_MONO=>KSAUDIO_SPEAKER_MONO";
92 return KSAUDIO_SPEAKER_MONO; 83 return KSAUDIO_SPEAKER_MONO;
93 case CHANNEL_LAYOUT_STEREO: 84 case CHANNEL_LAYOUT_STEREO:
94 DVLOG(2) << "CHANNEL_LAYOUT_STEREO=>KSAUDIO_SPEAKER_STEREO"; 85 DVLOG(2) << "CHANNEL_LAYOUT_STEREO=>KSAUDIO_SPEAKER_STEREO";
95 return KSAUDIO_SPEAKER_STEREO; 86 return KSAUDIO_SPEAKER_STEREO;
96 case CHANNEL_LAYOUT_QUAD: 87 case CHANNEL_LAYOUT_QUAD:
97 DVLOG(2) << "CHANNEL_LAYOUT_QUAD=>KSAUDIO_SPEAKER_QUAD"; 88 DVLOG(2) << "CHANNEL_LAYOUT_QUAD=>KSAUDIO_SPEAKER_QUAD";
98 return KSAUDIO_SPEAKER_QUAD; 89 return KSAUDIO_SPEAKER_QUAD;
99 case CHANNEL_LAYOUT_4_0: 90 case CHANNEL_LAYOUT_4_0:
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 956
966 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) { 957 if (variant.type() == VT_BSTR && variant.ptr()->bstrVal) {
967 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal), 958 base::WideToUTF8(variant.ptr()->bstrVal, wcslen(variant.ptr()->bstrVal),
968 driver_version); 959 driver_version);
969 } 960 }
970 961
971 return true; 962 return true;
972 } 963 }
973 964
974 } // namespace media 965 } // namespace media
OLDNEW
« 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