Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: content/renderer/media/audio_device_factory.cc

Issue 10836025: Part 1: Plumb render view ID to render host (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_output_ipc_impl.h"
9 #include "content/renderer/media/audio_input_message_filter.h" 10 #include "content/renderer/media/audio_input_message_filter.h"
10 #include "content/renderer/media/audio_message_filter.h" 11 #include "content/renderer/media/audio_message_filter.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) {
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 new AudioOutputIPCImpl(render_view_id),
27 ChildProcess::current()->io_message_loop()->message_loop_proxy()); 29 ChildProcess::current()->io_message_loop()->message_loop_proxy());
28 } 30 }
29 31
30 // static 32 // static
31 media::AudioInputDevice* AudioDeviceFactory::NewInputDevice() { 33 media::AudioInputDevice* AudioDeviceFactory::NewInputDevice() {
32 media::AudioInputDevice* device = NULL; 34 media::AudioInputDevice* device = NULL;
33 if (factory_) 35 if (factory_)
34 device = factory_->CreateInputDevice(); 36 device = factory_->CreateInputDevice();
35 37
36 return device ? device : new media::AudioInputDevice( 38 return device ? device : new media::AudioInputDevice(
37 AudioInputMessageFilter::Get(), 39 AudioInputMessageFilter::Get(),
38 ChildProcess::current()->io_message_loop()->message_loop_proxy()); 40 ChildProcess::current()->io_message_loop()->message_loop_proxy());
39 } 41 }
40 42
41 AudioDeviceFactory::AudioDeviceFactory() { 43 AudioDeviceFactory::AudioDeviceFactory() {
42 DCHECK(!factory_) << "Can't register two factories at once."; 44 DCHECK(!factory_) << "Can't register two factories at once.";
43 factory_ = this; 45 factory_ = this;
44 } 46 }
45 47
46 AudioDeviceFactory::~AudioDeviceFactory() { 48 AudioDeviceFactory::~AudioDeviceFactory() {
47 factory_ = NULL; 49 factory_ = NULL;
48 } 50 }
49 51
50 } // namespace content 52 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698