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

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

Issue 12383016: Merge AssociateStreamWithProducer message into CreateStream message for both audio output and input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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/renderer/media/audio_input_message_filter.h" 8 #include "content/renderer/media/audio_input_message_filter.h"
9 #include "content/renderer/media/audio_message_filter.h" 9 #include "content/renderer/media/audio_message_filter.h"
10 #include "content/renderer/media/renderer_audio_output_device.h"
11 #include "media/audio/audio_input_device.h" 10 #include "media/audio/audio_input_device.h"
11 #include "media/audio/audio_output_device.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // static 15 // static
16 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; 16 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL;
17 17
18 // static 18 // static
19 scoped_refptr<RendererAudioOutputDevice> AudioDeviceFactory::NewOutputDevice() { 19 scoped_refptr<media::AudioOutputDevice> AudioDeviceFactory::NewOutputDevice(
20 RendererAudioOutputDevice* device = NULL; 20 int render_view_id) {
21 media::AudioOutputDevice* device = NULL;
21 if (factory_) 22 if (factory_)
22 device = factory_->CreateOutputDevice(); 23 device = factory_->CreateOutputDevice(render_view_id);
23 24 return device ? device : new media::AudioOutputDevice(
24 return device ? device : new RendererAudioOutputDevice( 25 AudioMessageFilter::Get()->CreateAudioOutputIPC(render_view_id),
25 AudioMessageFilter::Get(), AudioMessageFilter::Get()->io_message_loop()); 26 AudioMessageFilter::Get()->io_message_loop());
26 } 27 }
27 28
28 // static 29 // static
29 scoped_refptr<media::AudioInputDevice> AudioDeviceFactory::NewInputDevice() { 30 scoped_refptr<media::AudioInputDevice> AudioDeviceFactory::NewInputDevice(
31 int render_view_id) {
30 media::AudioInputDevice* device = NULL; 32 media::AudioInputDevice* device = NULL;
31 if (factory_) 33 if (factory_)
32 device = factory_->CreateInputDevice(); 34 device = factory_->CreateInputDevice(render_view_id);
33
34 return device ? device : new media::AudioInputDevice( 35 return device ? device : new media::AudioInputDevice(
35 AudioInputMessageFilter::Get(), 36 AudioInputMessageFilter::Get()->CreateAudioInputIPC(render_view_id),
36 AudioInputMessageFilter::Get()->io_message_loop()); 37 AudioInputMessageFilter::Get()->io_message_loop());
37 } 38 }
38 39
39 AudioDeviceFactory::AudioDeviceFactory() { 40 AudioDeviceFactory::AudioDeviceFactory() {
40 DCHECK(!factory_) << "Can't register two factories at once."; 41 DCHECK(!factory_) << "Can't register two factories at once.";
41 factory_ = this; 42 factory_ = this;
42 } 43 }
43 44
44 AudioDeviceFactory::~AudioDeviceFactory() { 45 AudioDeviceFactory::~AudioDeviceFactory() {
45 factory_ = NULL; 46 factory_ = NULL;
46 } 47 }
47 48
48 } // namespace content 49 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698