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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "media/audio/audio_input_stream_impl.h" | 6 #include "media/audio/audio_input_stream_impl.h" |
7 | 7 |
| 8 namespace media { |
| 9 |
8 static const int kMinIntervalBetweenVolumeUpdatesMs = 1000; | 10 static const int kMinIntervalBetweenVolumeUpdatesMs = 1000; |
9 | 11 |
10 AudioInputStreamImpl::AudioInputStreamImpl() | 12 AudioInputStreamImpl::AudioInputStreamImpl() |
11 : agc_is_enabled_(false), | 13 : agc_is_enabled_(false), |
12 max_volume_(0.0), | 14 max_volume_(0.0), |
13 normalized_volume_(0.0) { | 15 normalized_volume_(0.0) { |
14 } | 16 } |
15 | 17 |
16 AudioInputStreamImpl::~AudioInputStreamImpl() {} | 18 AudioInputStreamImpl::~AudioInputStreamImpl() {} |
17 | 19 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 max_volume_ = GetMaxVolume(); | 61 max_volume_ = GetMaxVolume(); |
60 } | 62 } |
61 | 63 |
62 if (max_volume_ != 0.0) { | 64 if (max_volume_ != 0.0) { |
63 // Retrieve the current volume level by asking the audio hardware. | 65 // Retrieve the current volume level by asking the audio hardware. |
64 // Range is normalized to [0.0,1.0] or [0.0, 1.5] on Linux. | 66 // Range is normalized to [0.0,1.0] or [0.0, 1.5] on Linux. |
65 normalized_volume_ = GetVolume() / max_volume_; | 67 normalized_volume_ = GetVolume() / max_volume_; |
66 } | 68 } |
67 } | 69 } |
68 | 70 |
| 71 } // namespace media |
OLD | NEW |