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 "content/renderer/media/audio_device_factory.h" | 5 #include "content/renderer/media/audio_device_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/child_process.h" | 8 #include "content/common/child_process.h" |
9 #include "content/renderer/media/audio_input_message_filter.h" | 9 #include "content/renderer/media/audio_input_message_filter.h" |
10 #include "content/renderer/media/audio_message_filter.h" | 10 #include "content/renderer/media/audio_message_filter.h" |
| 11 #include "content/renderer/media/renderer_audio_output_device.h" |
11 #include "media/audio/audio_input_device.h" | 12 #include "media/audio/audio_input_device.h" |
12 #include "media/audio/audio_output_device.h" | |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 // static | 16 // static |
17 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; | 17 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; |
18 | 18 |
19 // static | 19 // static |
20 media::AudioRendererSink* AudioDeviceFactory::NewOutputDevice() { | 20 scoped_refptr<RendererAudioOutputDevice> AudioDeviceFactory::NewOutputDevice() { |
21 media::AudioRendererSink* device = NULL; | 21 RendererAudioOutputDevice* device = NULL; |
22 if (factory_) | 22 if (factory_) |
23 device = factory_->CreateOutputDevice(); | 23 device = factory_->CreateOutputDevice(); |
24 | 24 |
25 return device ? device : new media::AudioOutputDevice( | 25 return device ? device : new RendererAudioOutputDevice( |
26 AudioMessageFilter::Get(), | 26 AudioMessageFilter::Get(), |
27 ChildProcess::current()->io_message_loop()->message_loop_proxy()); | 27 ChildProcess::current()->io_message_loop()->message_loop_proxy()); |
28 } | 28 } |
29 | 29 |
30 // static | 30 // static |
31 media::AudioInputDevice* AudioDeviceFactory::NewInputDevice() { | 31 scoped_refptr<media::AudioInputDevice> AudioDeviceFactory::NewInputDevice() { |
32 media::AudioInputDevice* device = NULL; | 32 media::AudioInputDevice* device = NULL; |
33 if (factory_) | 33 if (factory_) |
34 device = factory_->CreateInputDevice(); | 34 device = factory_->CreateInputDevice(); |
35 | 35 |
36 return device ? device : new media::AudioInputDevice( | 36 return device ? device : new media::AudioInputDevice( |
37 AudioInputMessageFilter::Get(), | 37 AudioInputMessageFilter::Get(), |
38 ChildProcess::current()->io_message_loop()->message_loop_proxy()); | 38 ChildProcess::current()->io_message_loop()->message_loop_proxy()); |
39 } | 39 } |
40 | 40 |
41 AudioDeviceFactory::AudioDeviceFactory() { | 41 AudioDeviceFactory::AudioDeviceFactory() { |
42 DCHECK(!factory_) << "Can't register two factories at once."; | 42 DCHECK(!factory_) << "Can't register two factories at once."; |
43 factory_ = this; | 43 factory_ = this; |
44 } | 44 } |
45 | 45 |
46 AudioDeviceFactory::~AudioDeviceFactory() { | 46 AudioDeviceFactory::~AudioDeviceFactory() { |
47 factory_ = NULL; | 47 factory_ = NULL; |
48 } | 48 } |
49 | 49 |
50 } // namespace content | 50 } // namespace content |
OLD | NEW |