| 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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_PROCESSED_LOCAL_AUDIO_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_PROCESSED_LOCAL_AUDIO_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PROCESSED_LOCAL_AUDIO_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PROCESSED_LOCAL_AUDIO_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/atomicops.h" | 8 #include "base/atomicops.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // Gets/Sets source constraints. Using this is optional, but must be done | 60 // Gets/Sets source constraints. Using this is optional, but must be done |
| 61 // before the first call to ConnectToTrack(). | 61 // before the first call to ConnectToTrack(). |
| 62 const blink::WebMediaConstraints& source_constraints() const { | 62 const blink::WebMediaConstraints& source_constraints() const { |
| 63 return constraints_; | 63 return constraints_; |
| 64 } | 64 } |
| 65 void SetSourceConstraints(const blink::WebMediaConstraints& constraints); | 65 void SetSourceConstraints(const blink::WebMediaConstraints& constraints); |
| 66 | 66 |
| 67 // The following accessors are not valid until after the source is started | 67 // The following accessors are not valid until after the source is started |
| 68 // (when the first track is connected). | 68 // (when the first track is connected). |
| 69 webrtc::AudioSourceInterface* rtc_source() const { return rtc_source_.get(); } | |
| 70 const scoped_refptr<MediaStreamAudioProcessor>& audio_processor() const { | 69 const scoped_refptr<MediaStreamAudioProcessor>& audio_processor() const { |
| 71 return audio_processor_; | 70 return audio_processor_; |
| 72 } | 71 } |
| 73 const scoped_refptr<MediaStreamAudioLevelCalculator::Level>& audio_level() | 72 const scoped_refptr<MediaStreamAudioLevelCalculator::Level>& audio_level() |
| 74 const { | 73 const { |
| 75 return level_calculator_.level(); | 74 return level_calculator_.level(); |
| 76 } | 75 } |
| 77 | 76 |
| 78 // Thread-safe volume accessors used by WebRtcAudioDeviceImpl. | 77 // Thread-safe volume accessors used by WebRtcAudioDeviceImpl. |
| 79 void SetVolume(int volume); | 78 void SetVolume(int volume); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Audio processor doing processing like FIFO, AGC, AEC and NS. Its output | 119 // Audio processor doing processing like FIFO, AGC, AEC and NS. Its output |
| 121 // data is in a unit of 10 ms data chunk. | 120 // data is in a unit of 10 ms data chunk. |
| 122 scoped_refptr<MediaStreamAudioProcessor> audio_processor_; | 121 scoped_refptr<MediaStreamAudioProcessor> audio_processor_; |
| 123 | 122 |
| 124 // The device created by the AudioDeviceFactory in EnsureSourceIsStarted(). | 123 // The device created by the AudioDeviceFactory in EnsureSourceIsStarted(). |
| 125 scoped_refptr<media::AudioCapturerSource> source_; | 124 scoped_refptr<media::AudioCapturerSource> source_; |
| 126 | 125 |
| 127 // Lock used to ensure thread-safe access to |source_| by SetVolume(). | 126 // Lock used to ensure thread-safe access to |source_| by SetVolume(). |
| 128 mutable base::Lock source_lock_; | 127 mutable base::Lock source_lock_; |
| 129 | 128 |
| 130 // Holder for WebRTC audio pipeline objects. Created in | |
| 131 // EnsureSourceIsStarted(). | |
| 132 scoped_refptr<webrtc::AudioSourceInterface> rtc_source_; | |
| 133 | |
| 134 // Stores latest microphone volume received in a CaptureData() callback. | 129 // Stores latest microphone volume received in a CaptureData() callback. |
| 135 // Range is [0, 255]. | 130 // Range is [0, 255]. |
| 136 base::subtle::Atomic32 volume_; | 131 base::subtle::Atomic32 volume_; |
| 137 | 132 |
| 138 // Used to calculate the signal level that shows in the UI. | 133 // Used to calculate the signal level that shows in the UI. |
| 139 MediaStreamAudioLevelCalculator level_calculator_; | 134 MediaStreamAudioLevelCalculator level_calculator_; |
| 140 | 135 |
| 141 bool allow_invalid_render_frame_id_for_testing_; | 136 bool allow_invalid_render_frame_id_for_testing_; |
| 142 | 137 |
| 143 DISALLOW_COPY_AND_ASSIGN(ProcessedLocalAudioSource); | 138 DISALLOW_COPY_AND_ASSIGN(ProcessedLocalAudioSource); |
| 144 }; | 139 }; |
| 145 | 140 |
| 146 } // namespace content | 141 } // namespace content |
| 147 | 142 |
| 148 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PROCESSED_LOCAL_AUDIO_SOURCE_H_ | 143 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PROCESSED_LOCAL_AUDIO_SOURCE_H_ |
| OLD | NEW |