Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/audio_device_listener_win.h" | 5 #include "media/audio/win/audio_device_listener_win.h" |
| 6 | 6 |
| 7 #include <Audioclient.h> | 7 #include <Audioclient.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 EDataFlow flow, ERole role, LPCWSTR new_default_device_id) { | 139 EDataFlow flow, ERole role, LPCWSTR new_default_device_id) { |
| 140 // Only listen for console and communication device changes. | 140 // Only listen for console and communication device changes. |
| 141 if ((role != eConsole && role != eCommunications) || | 141 if ((role != eConsole && role != eCommunications) || |
| 142 (flow != eRender && flow != eCapture)) { | 142 (flow != eRender && flow != eCapture)) { |
| 143 return S_OK; | 143 return S_OK; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Grab a pointer to the appropriate ID member. | 146 // Grab a pointer to the appropriate ID member. |
| 147 // Note that there are three "?:"'s here to select the right ID. | 147 // Note that there are three "?:"'s here to select the right ID. |
| 148 std::string* current_device_id = | 148 std::string* current_device_id = |
| 149 role == eRender ? ( | 149 role == eConsole ? ( |
|
tommi (sloooow) - chröme
2014/07/28 22:48:38
ehm, thanks for fixing this. Sadly (mea culpa) I'm
| |
| 150 flow == eConsole ? | 150 flow == eRender ? |
| 151 &default_render_device_id_ : | 151 &default_render_device_id_ : |
| 152 &default_communications_render_device_id_ | 152 &default_communications_render_device_id_ |
| 153 ) : ( | 153 ) : ( |
| 154 flow == eConsole ? | 154 flow == eRender ? |
| 155 &default_capture_device_id_ : | 155 &default_capture_device_id_ : |
| 156 &default_communications_capture_device_id_ | 156 &default_communications_capture_device_id_ |
| 157 ); | 157 ); |
| 158 | 158 |
| 159 // If no device is now available, |new_default_device_id| will be NULL. | 159 // If no device is now available, |new_default_device_id| will be NULL. |
| 160 std::string new_device_id; | 160 std::string new_device_id; |
| 161 if (new_default_device_id) | 161 if (new_default_device_id) |
| 162 new_device_id = base::WideToUTF8(new_default_device_id); | 162 new_device_id = base::WideToUTF8(new_default_device_id); |
| 163 | 163 |
| 164 VLOG(1) << "OnDefaultDeviceChanged() " | 164 VLOG(1) << "OnDefaultDeviceChanged() " |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 176 return S_OK; | 176 return S_OK; |
| 177 | 177 |
| 178 // Store the new id in the member variable (that current_device_id points to). | 178 // Store the new id in the member variable (that current_device_id points to). |
| 179 *current_device_id = new_device_id; | 179 *current_device_id = new_device_id; |
| 180 listener_cb_.Run(); | 180 listener_cb_.Run(); |
| 181 | 181 |
| 182 return S_OK; | 182 return S_OK; |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace media | 185 } // namespace media |
| OLD | NEW |