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

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

Issue 9702019: Adds Analog Gain Control (AGC) to the WebRTC client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 9 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 | Annotate | Revision Log
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/audio_low_latency_output_win.h" 5 #include "media/audio/win/audio_low_latency_output_win.h"
6 6
7 #include <Functiondiscoverykeys_devpkey.h> 7 #include <Functiondiscoverykeys_devpkey.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 DLOG_IF(ERROR, FAILED(hr)) << "Failed to disable device notifications: " 234 DLOG_IF(ERROR, FAILED(hr)) << "Failed to disable device notifications: "
235 << std::hex << hr; 235 << std::hex << hr;
236 } 236 }
237 237
238 // Inform the audio manager that we have been closed. This will cause our 238 // Inform the audio manager that we have been closed. This will cause our
239 // destruction. 239 // destruction.
240 manager_->ReleaseOutputStream(this); 240 manager_->ReleaseOutputStream(this);
241 } 241 }
242 242
243 void WASAPIAudioOutputStream::SetVolume(double volume) { 243 void WASAPIAudioOutputStream::SetVolume(double volume) {
244 DVLOG(1) << "SetVolume(volume=" << volume << ")";
244 float volume_float = static_cast<float>(volume); 245 float volume_float = static_cast<float>(volume);
245 if (volume_float < 0.0f || volume_float > 1.0f) { 246 if (volume_float < 0.0f || volume_float > 1.0f) {
246 return; 247 return;
247 } 248 }
248 volume_ = volume_float; 249 volume_ = volume_float;
249 } 250 }
250 251
251 void WASAPIAudioOutputStream::GetVolume(double* volume) { 252 void WASAPIAudioOutputStream::GetVolume(double* volume) {
253 DVLOG(1) << "GetVolume()";
252 *volume = static_cast<double>(volume_); 254 *volume = static_cast<double>(volume_);
253 } 255 }
254 256
255 // static 257 // static
256 int WASAPIAudioOutputStream::HardwareSampleRate(ERole device_role) { 258 int WASAPIAudioOutputStream::HardwareSampleRate(ERole device_role) {
257 // It is assumed that this static method is called from a COM thread, i.e., 259 // It is assumed that this static method is called from a COM thread, i.e.,
258 // CoInitializeEx() is not called here again to avoid STA/MTA conflicts. 260 // CoInitializeEx() is not called here again to avoid STA/MTA conflicts.
259 ScopedComPtr<IMMDeviceEnumerator> enumerator; 261 ScopedComPtr<IMMDeviceEnumerator> enumerator;
260 HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), 262 HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator),
261 NULL, 263 NULL,
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 801
800 // All released interfaces (IAudioRenderClient, IAudioClient, IMMDevice) 802 // All released interfaces (IAudioRenderClient, IAudioClient, IMMDevice)
801 // are now re-initiated and it is now possible to re-start audio rendering. 803 // are now re-initiated and it is now possible to re-start audio rendering.
802 804
803 // Start rendering again using the new default audio endpoint. 805 // Start rendering again using the new default audio endpoint.
804 hr = audio_client_->Start(); 806 hr = audio_client_->Start();
805 807
806 restart_rendering_mode_ = false; 808 restart_rendering_mode_ = false;
807 return SUCCEEDED(hr); 809 return SUCCEEDED(hr);
808 } 810 }
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_input_win_unittest.cc ('k') | media/audio/win/wavein_input_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698