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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/synchronization/condition_variable.h" | |
| 13 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
| 14 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 15 #include "content/renderer/media/webrtc_audio_device_impl.h" | 16 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 16 #include "content/renderer/media/webrtc_local_audio_renderer.h" | 17 #include "content/renderer/media/webrtc_local_audio_renderer.h" |
| 17 #include "media/audio/audio_input_device.h" | 18 #include "media/audio/audio_input_device.h" |
| 18 #include "media/base/audio_capturer_source.h" | 19 #include "media/base/audio_capturer_source.h" |
| 19 #include "media/base/audio_fifo.h" | 20 #include "media/base/audio_fifo.h" |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| 22 class AudioBus; | 23 class AudioBus; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 | 159 |
| 159 protected: | 160 protected: |
| 160 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>; | 161 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>; |
| 161 virtual ~WebRtcAudioCapturer(); | 162 virtual ~WebRtcAudioCapturer(); |
| 162 | 163 |
| 163 private: | 164 private: |
| 164 typedef std::list<WebRtcAudioCapturerSink*> SinkList; | 165 typedef std::list<WebRtcAudioCapturerSink*> SinkList; |
| 165 | 166 |
| 166 WebRtcAudioCapturer(); | 167 WebRtcAudioCapturer(); |
| 167 | 168 |
| 169 // Reconfigures the capturer with a new buffer size and capture parameters. | |
| 170 // Must be called without holding the lock. Returns true on success. | |
| 171 bool Reconfigure(int sample_rate, media::AudioParameters::Format format, | |
| 172 media::ChannelLayout channel_layout); | |
| 173 | |
| 168 // Used to DCHECK that we are called on the correct thread. | 174 // Used to DCHECK that we are called on the correct thread. |
| 169 base::ThreadChecker thread_checker_; | 175 base::ThreadChecker thread_checker_; |
| 170 | 176 |
| 171 // Protects |source_|, |sinks_|, |running_|, |on_device_stopped_cb_|, | 177 // Protects |source_|, |sinks_|, |running_|, |on_device_stopped_cb_|, |
| 172 // |loopback_fifo_| and |buffering_|. | 178 // |loopback_fifo_|, |params| and |buffering_|. |
|
tommi (sloooow) - chröme
2013/02/07 14:57:47
params_
| |
| 173 base::Lock lock_; | 179 base::Lock lock_; |
| 174 | 180 |
| 181 // Keeps us from reconfiguring the buffer while the buffer is being used. | |
| 182 base::ConditionVariable buffer_in_use_cv_; | |
| 183 bool buffer_in_use_; | |
| 184 | |
| 175 // A list of sinks that the audio data is fed to. | 185 // A list of sinks that the audio data is fed to. |
| 176 SinkList sinks_; | 186 SinkList sinks_; |
| 177 | 187 |
| 178 // The audio data source from the browser process. | 188 // The audio data source from the browser process. |
| 179 scoped_refptr<media::AudioCapturerSource> source_; | 189 scoped_refptr<media::AudioCapturerSource> source_; |
| 180 | 190 |
| 181 // Cached values of utilized audio parameters. Platform dependent. | 191 // Cached values of utilized audio parameters. Platform dependent. |
| 182 media::AudioParameters params_; | 192 media::AudioParameters params_; |
| 183 | 193 |
| 184 // Buffers used for temporary storage during capture callbacks. | 194 // Buffers used for temporary storage during capture callbacks. |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 197 | 207 |
| 198 // True when FIFO is utilized, false otherwise. | 208 // True when FIFO is utilized, false otherwise. |
| 199 bool buffering_; | 209 bool buffering_; |
| 200 | 210 |
| 201 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); | 211 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); |
| 202 }; | 212 }; |
| 203 | 213 |
| 204 } // namespace content | 214 } // namespace content |
| 205 | 215 |
| 206 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | 216 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ |
| OLD | NEW |