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

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: Addressed review comments. 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" 10 #include "content/renderer/render_thread_impl.h"
11 #include "media/audio/audio_input_device.h" 11 #include "media/audio/audio_input_device.h"
12 #include "media/audio/audio_output_device.h"
12 13
13 namespace content { 14 namespace content {
14 15
15 // static 16 // static
16 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; 17 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL;
17 18
18 // static 19 // static
19 scoped_refptr<RendererAudioOutputDevice> AudioDeviceFactory::NewOutputDevice() { 20 scoped_refptr<media::AudioOutputDevice> AudioDeviceFactory::NewOutputDevice(
20 RendererAudioOutputDevice* device = NULL; 21 int render_view_id) {
21 if (factory_) 22 if (factory_) {
22 device = factory_->CreateOutputDevice(); 23 media::AudioOutputDevice* const device =
24 factory_->CreateOutputDevice(render_view_id);
25 if (device)
26 return device;
27 }
23 28
24 return device ? device : new RendererAudioOutputDevice( 29 AudioMessageFilter* const filter =
25 AudioMessageFilter::Get(), AudioMessageFilter::Get()->io_message_loop()); 30 RenderThreadImpl::current()->audio_message_filter();
DaleCurtis 2013/03/07 21:02:58 I don't think this works? AudioRendererMixerManage
miu 2013/04/16 00:07:36 I dedcided to put the AudioMessageFilter::Get() st
31 return new media::AudioOutputDevice(
32 filter->CreateAudioOutputIPC(render_view_id), filter->io_message_loop());
26 } 33 }
27 34
28 // static 35 // static
29 scoped_refptr<media::AudioInputDevice> AudioDeviceFactory::NewInputDevice() { 36 scoped_refptr<media::AudioInputDevice> AudioDeviceFactory::NewInputDevice(
30 media::AudioInputDevice* device = NULL; 37 int render_view_id) {
31 if (factory_) 38 if (factory_) {
32 device = factory_->CreateInputDevice(); 39 media::AudioInputDevice* const device =
40 factory_->CreateInputDevice(render_view_id);
41 if (device)
42 return device;
43 }
33 44
34 return device ? device : new media::AudioInputDevice( 45 AudioInputMessageFilter* const filter =
35 AudioInputMessageFilter::Get(), 46 RenderThreadImpl::current()->audio_input_message_filter();
36 AudioInputMessageFilter::Get()->io_message_loop()); 47 return new media::AudioInputDevice(
48 filter->CreateAudioInputIPC(render_view_id), filter->io_message_loop());
37 } 49 }
38 50
39 AudioDeviceFactory::AudioDeviceFactory() { 51 AudioDeviceFactory::AudioDeviceFactory() {
40 DCHECK(!factory_) << "Can't register two factories at once."; 52 DCHECK(!factory_) << "Can't register two factories at once.";
41 factory_ = this; 53 factory_ = this;
42 } 54 }
43 55
44 AudioDeviceFactory::~AudioDeviceFactory() { 56 AudioDeviceFactory::~AudioDeviceFactory() {
45 factory_ = NULL; 57 factory_ = NULL;
46 } 58 }
47 59
48 } // namespace content 60 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698