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

Side by Side Diff: chromeos/audio/audio_device.cc

Issue 2222903002: audio_device: Add lineout node type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « chromeos/audio/audio_device.h ('k') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chromeos/audio/audio_device.h" 5 #include "chromeos/audio/audio_device.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 namespace { 16 namespace {
17 17
18 // Get the priority for a particular device type. The priority returned 18 // Get the priority for a particular device type. The priority returned
19 // will be between 0 to 3, the higher number meaning a higher priority. 19 // will be between 0 to 3, the higher number meaning a higher priority.
20 uint8_t GetDevicePriority(AudioDeviceType type, bool is_input) { 20 uint8_t GetDevicePriority(AudioDeviceType type, bool is_input) {
21 // Lower the priority of bluetooth mic to prevent unexpected bad eperience 21 // Lower the priority of bluetooth mic to prevent unexpected bad eperience
22 // to user because of bluetooth audio profile switching. Make priority to 22 // to user because of bluetooth audio profile switching. Make priority to
23 // zero so this mic will never be automatically chosen. 23 // zero so this mic will never be automatically chosen.
24 if (type == AUDIO_TYPE_BLUETOOTH && is_input) 24 if (type == AUDIO_TYPE_BLUETOOTH && is_input)
25 return 0; 25 return 0;
26 switch (type) { 26 switch (type) {
27 case AUDIO_TYPE_HEADPHONE: 27 case AUDIO_TYPE_HEADPHONE:
28 case AUDIO_TYPE_LINEOUT:
28 case AUDIO_TYPE_MIC: 29 case AUDIO_TYPE_MIC:
29 case AUDIO_TYPE_USB: 30 case AUDIO_TYPE_USB:
30 case AUDIO_TYPE_BLUETOOTH: 31 case AUDIO_TYPE_BLUETOOTH:
31 return 3; 32 return 3;
32 case AUDIO_TYPE_HDMI: 33 case AUDIO_TYPE_HDMI:
33 return 2; 34 return 2;
34 case AUDIO_TYPE_INTERNAL_SPEAKER: 35 case AUDIO_TYPE_INTERNAL_SPEAKER:
35 case AUDIO_TYPE_INTERNAL_MIC: 36 case AUDIO_TYPE_INTERNAL_MIC:
36 return 1; 37 return 1;
37 case AUDIO_TYPE_KEYBOARD_MIC: 38 case AUDIO_TYPE_KEYBOARD_MIC:
(...skipping 22 matching lines...) Expand all
60 case AUDIO_TYPE_HDMI: 61 case AUDIO_TYPE_HDMI:
61 return "HDMI"; 62 return "HDMI";
62 case AUDIO_TYPE_INTERNAL_SPEAKER: 63 case AUDIO_TYPE_INTERNAL_SPEAKER:
63 return "INTERNAL_SPEAKER"; 64 return "INTERNAL_SPEAKER";
64 case AUDIO_TYPE_INTERNAL_MIC: 65 case AUDIO_TYPE_INTERNAL_MIC:
65 return "INTERNAL_MIC"; 66 return "INTERNAL_MIC";
66 case AUDIO_TYPE_KEYBOARD_MIC: 67 case AUDIO_TYPE_KEYBOARD_MIC:
67 return "KEYBOARD_MIC"; 68 return "KEYBOARD_MIC";
68 case AUDIO_TYPE_HOTWORD: 69 case AUDIO_TYPE_HOTWORD:
69 return "HOTWORD"; 70 return "HOTWORD";
71 case AUDIO_TYPE_LINEOUT:
72 return "LINEOUT";
70 case AUDIO_TYPE_POST_MIX_LOOPBACK: 73 case AUDIO_TYPE_POST_MIX_LOOPBACK:
71 return "POST_MIX_LOOPBACK"; 74 return "POST_MIX_LOOPBACK";
72 case AUDIO_TYPE_POST_DSP_LOOPBACK: 75 case AUDIO_TYPE_POST_DSP_LOOPBACK:
73 return "POST_DSP_LOOPBACK"; 76 return "POST_DSP_LOOPBACK";
74 case AUDIO_TYPE_OTHER: 77 case AUDIO_TYPE_OTHER:
75 default: 78 default:
76 return "OTHER"; 79 return "OTHER";
77 } 80 }
78 } 81 }
79 82
(...skipping 15 matching lines...) Expand all
95 else if (node_type.find("HDMI") != std::string::npos) 98 else if (node_type.find("HDMI") != std::string::npos)
96 return AUDIO_TYPE_HDMI; 99 return AUDIO_TYPE_HDMI;
97 else if (node_type.find("INTERNAL_SPEAKER") != std::string::npos) 100 else if (node_type.find("INTERNAL_SPEAKER") != std::string::npos)
98 return AUDIO_TYPE_INTERNAL_SPEAKER; 101 return AUDIO_TYPE_INTERNAL_SPEAKER;
99 // TODO(hychao): Remove the 'AOKR' matching line after CRAS switches 102 // TODO(hychao): Remove the 'AOKR' matching line after CRAS switches
100 // node type naming to 'HOTWORD'. 103 // node type naming to 'HOTWORD'.
101 else if (node_type.find("AOKR") != std::string::npos) 104 else if (node_type.find("AOKR") != std::string::npos)
102 return AUDIO_TYPE_HOTWORD; 105 return AUDIO_TYPE_HOTWORD;
103 else if (node_type.find("HOTWORD") != std::string::npos) 106 else if (node_type.find("HOTWORD") != std::string::npos)
104 return AUDIO_TYPE_HOTWORD; 107 return AUDIO_TYPE_HOTWORD;
108 else if (node_type.find("LINEOUT") != std::string::npos)
109 return AUDIO_TYPE_LINEOUT;
105 else if (node_type.find("POST_MIX_LOOPBACK") != std::string::npos) 110 else if (node_type.find("POST_MIX_LOOPBACK") != std::string::npos)
106 return AUDIO_TYPE_POST_MIX_LOOPBACK; 111 return AUDIO_TYPE_POST_MIX_LOOPBACK;
107 else if (node_type.find("POST_DSP_LOOPBACK") != std::string::npos) 112 else if (node_type.find("POST_DSP_LOOPBACK") != std::string::npos)
108 return AUDIO_TYPE_POST_DSP_LOOPBACK; 113 return AUDIO_TYPE_POST_DSP_LOOPBACK;
109 else 114 else
110 return AUDIO_TYPE_OTHER; 115 return AUDIO_TYPE_OTHER;
111 } 116 }
112 117
113 AudioDevice::AudioDevice() 118 AudioDevice::AudioDevice()
114 : is_input(false), 119 : is_input(false),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 active ? "true" : "false"); 168 active ? "true" : "false");
164 base::StringAppendF(&result, 169 base::StringAppendF(&result,
165 "plugged_time= %s ", 170 "plugged_time= %s ",
166 base::Uint64ToString(plugged_time).c_str()); 171 base::Uint64ToString(plugged_time).c_str());
167 base::StringAppendF(&result, "mic_positions = %s ", mic_positions.c_str()); 172 base::StringAppendF(&result, "mic_positions = %s ", mic_positions.c_str());
168 173
169 return result; 174 return result;
170 } 175 }
171 176
172 } // namespace chromeos 177 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/audio/audio_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698