Chromium Code Reviews| Index: content/renderer/media/webrtc_audio_device_impl.cc |
| diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc |
| index 37d2f3d6aeaba6d77bb7d890f373bb8e0d98a75c..dc519f2bf4cb9812a2826493f0aaf4dba37d78be 100644 |
| --- a/content/renderer/media/webrtc_audio_device_impl.cc |
| +++ b/content/renderer/media/webrtc_audio_device_impl.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/metrics/histogram.h" |
| #include "base/string_util.h" |
| #include "base/win/windows_version.h" |
| +#include "content/renderer/media/audio_device_factory.h" |
| #include "content/renderer/media/audio_hardware.h" |
| #include "content/renderer/render_thread_impl.h" |
| #include "media/audio/audio_util.h" |
| @@ -141,8 +142,12 @@ WebRtcAudioDeviceImpl::WebRtcAudioDeviceImpl() |
| recording_(false), |
| agc_is_enabled_(false) { |
| DVLOG(1) << "WebRtcAudioDeviceImpl::WebRtcAudioDeviceImpl()"; |
|
scherkus (not reviewing)
2012/06/26 23:34:30
can you fix the indentation here? this code should
henrika (OOO until Aug 14)
2012/06/27 08:23:16
Done.
|
| + // TODO(henrika): remove this restriction when factory is used for the |
| + // input side as well. |
| DCHECK(RenderThreadImpl::current()) << |
| "WebRtcAudioDeviceImpl must be constructed on the render thread"; |
| + audio_output_device_ = AudioDeviceFactory::Create(); |
| + DCHECK(audio_output_device_); |
| } |
| WebRtcAudioDeviceImpl::~WebRtcAudioDeviceImpl() { |
| @@ -410,7 +415,6 @@ int32_t WebRtcAudioDeviceImpl::Init() { |
| return 0; |
| DCHECK(!audio_input_device_); |
| - DCHECK(!audio_output_device_); |
| DCHECK(!input_buffer_.get()); |
| DCHECK(!output_buffer_.get()); |
| @@ -583,11 +587,10 @@ int32_t WebRtcAudioDeviceImpl::Init() { |
| AddHistogramFramesPerBuffer(kAudioOutput, out_buffer_size); |
| AddHistogramFramesPerBuffer(kAudioInput, in_buffer_size); |
| - // Create and configure the audio rendering client. |
| - audio_output_device_ = new AudioDevice(output_audio_parameters_, this); |
| + // Configure the audio rendering client. |
| + audio_output_device_->Initialize(output_audio_parameters_, this); |
| DCHECK(audio_input_device_); |
| - DCHECK(audio_output_device_); |
| // Allocate local audio buffers based on the parameters above. |
| // It is assumed that each audio sample contains 16 bits and each |
| @@ -627,13 +630,11 @@ int32_t WebRtcAudioDeviceImpl::Terminate() { |
| return 0; |
| DCHECK(audio_input_device_); |
| - DCHECK(audio_output_device_); |
| DCHECK(input_buffer_.get()); |
| DCHECK(output_buffer_.get()); |
| // Release all resources allocated in Init(). |
| audio_input_device_ = NULL; |
| - audio_output_device_ = NULL; |
| input_buffer_.reset(); |
| output_buffer_.reset(); |
| @@ -697,7 +698,7 @@ int32_t WebRtcAudioDeviceImpl::SetRecordingDevice(WindowsDeviceType device) { |
| int32_t WebRtcAudioDeviceImpl::PlayoutIsAvailable(bool* available) { |
| DVLOG(1) << "PlayoutIsAvailable()"; |
| - *available = (audio_output_device_ != NULL); |
| + *available = initialized(); |
| return 0; |
| } |
| @@ -709,7 +710,7 @@ int32_t WebRtcAudioDeviceImpl::InitPlayout() { |
| bool WebRtcAudioDeviceImpl::PlayoutIsInitialized() const { |
| DVLOG(1) << "PlayoutIsInitialized()"; |
| - return (audio_output_device_ != NULL); |
| + return initialized(); |
| } |
| int32_t WebRtcAudioDeviceImpl::RecordingIsAvailable(bool* available) { |