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/render_thread_impl.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 #include "media/audio/audio_output_device.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 // static | 17 // static |
17 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; | 18 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; |
18 | 19 |
19 // static | 20 // static |
20 media::AudioRendererSink* AudioDeviceFactory::NewOutputDevice() { | 21 media::AudioRendererSink* AudioDeviceFactory::NewOutputDevice( |
22 int render_view_id) { | |
tommi (sloooow) - chröme
2012/10/16 09:17:07
Why don't we do the same for the input device?
We
miu
2012/10/16 23:43:49
Done.
| |
21 media::AudioRendererSink* device = NULL; | 23 media::AudioRendererSink* device = NULL; |
22 if (factory_) | 24 if (factory_) |
23 device = factory_->CreateOutputDevice(); | 25 device = factory_->CreateOutputDevice(render_view_id); |
24 | 26 |
25 return device ? device : new media::AudioOutputDevice( | 27 return device ? device : new media::AudioOutputDevice( |
26 AudioMessageFilter::Get(), | 28 RenderThreadImpl::current()->audio_message_filter()-> |
29 CreateAudioOutputIPC(render_view_id), | |
27 ChildProcess::current()->io_message_loop()->message_loop_proxy()); | 30 ChildProcess::current()->io_message_loop()->message_loop_proxy()); |
28 } | 31 } |
29 | 32 |
30 // static | 33 // static |
31 media::AudioInputDevice* AudioDeviceFactory::NewInputDevice() { | 34 media::AudioInputDevice* AudioDeviceFactory::NewInputDevice() { |
32 media::AudioInputDevice* device = NULL; | 35 media::AudioInputDevice* device = NULL; |
33 if (factory_) | 36 if (factory_) |
34 device = factory_->CreateInputDevice(); | 37 device = factory_->CreateInputDevice(); |
35 | 38 |
36 return device ? device : new media::AudioInputDevice( | 39 return device ? device : new media::AudioInputDevice( |
37 AudioInputMessageFilter::Get(), | 40 AudioInputMessageFilter::Get(), |
38 ChildProcess::current()->io_message_loop()->message_loop_proxy()); | 41 ChildProcess::current()->io_message_loop()->message_loop_proxy()); |
39 } | 42 } |
40 | 43 |
41 AudioDeviceFactory::AudioDeviceFactory() { | 44 AudioDeviceFactory::AudioDeviceFactory() { |
42 DCHECK(!factory_) << "Can't register two factories at once."; | 45 DCHECK(!factory_) << "Can't register two factories at once."; |
43 factory_ = this; | 46 factory_ = this; |
44 } | 47 } |
45 | 48 |
46 AudioDeviceFactory::~AudioDeviceFactory() { | 49 AudioDeviceFactory::~AudioDeviceFactory() { |
47 factory_ = NULL; | 50 factory_ = NULL; |
48 } | 51 } |
49 | 52 |
50 } // namespace content | 53 } // namespace content |
OLD | NEW |