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

Side by Side Diff: media/audio/cras/cras_input.cc

Issue 645923002: Add support for audio input mute detection on all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 2 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 | « media/audio/cras/cras_input.h ('k') | media/audio/fake_audio_input_stream.h » ('j') | 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/cras/cras_input.h" 5 #include "media/audio/cras/cras_input.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 295
296 double CrasInputStream::GetVolume() { 296 double CrasInputStream::GetVolume() {
297 if (!client_) 297 if (!client_)
298 return 0.0; 298 return 0.0;
299 299
300 long dB = cras_client_get_system_capture_gain(client_) / 100.0; 300 long dB = cras_client_get_system_capture_gain(client_) / 100.0;
301 return GetVolumeRatioFromDecibels(dB); 301 return GetVolumeRatioFromDecibels(dB);
302 } 302 }
303 303
304 bool CrasInputStream::IsMuted() {
305 return false;
306 }
307
304 double CrasInputStream::GetVolumeRatioFromDecibels(double dB) const { 308 double CrasInputStream::GetVolumeRatioFromDecibels(double dB) const {
305 return pow(10, dB / 20.0); 309 return pow(10, dB / 20.0);
306 } 310 }
307 311
308 double CrasInputStream::GetDecibelsFromVolumeRatio(double volume_ratio) const { 312 double CrasInputStream::GetDecibelsFromVolumeRatio(double volume_ratio) const {
309 return 20 * log10(volume_ratio); 313 return 20 * log10(volume_ratio);
310 } 314 }
311 315
312 } // namespace media 316 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/cras/cras_input.h ('k') | media/audio/fake_audio_input_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698