| 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/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 "media/audio/audio_input_device.h" | 10 #include "media/audio/audio_input_device.h" |
| 11 #include "media/audio/audio_output_device.h" | 11 #include "media/audio/audio_output_device.h" |
| 12 #include "url/origin.h" | 12 #include "url/origin.h" |
| 13 | 13 |
| 14 #include "base/debug/stack_trace.h" |
| 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 // static | 18 // static |
| 17 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; | 19 AudioDeviceFactory* AudioDeviceFactory::factory_ = NULL; |
| 18 | 20 |
| 19 // static | 21 // static |
| 20 scoped_refptr<media::AudioOutputDevice> AudioDeviceFactory::NewOutputDevice( | 22 scoped_refptr<media::AudioOutputDevice> AudioDeviceFactory::NewOutputDevice( |
| 21 int render_frame_id, | 23 int render_frame_id, |
| 22 int session_id, | 24 int session_id, |
| 23 const std::string& device_id, | 25 const std::string& device_id, |
| 24 const url::Origin& security_origin) { | 26 const url::Origin& security_origin) { |
| 27 // base::debug::StackTrace st; |
| 28 // st.Print(); |
| 29 |
| 25 if (factory_) { | 30 if (factory_) { |
| 26 media::AudioOutputDevice* const device = factory_->CreateOutputDevice( | 31 media::AudioOutputDevice* const device = factory_->CreateOutputDevice( |
| 27 render_frame_id, session_id, device_id, security_origin); | 32 render_frame_id, session_id, device_id, security_origin); |
| 28 if (device) | 33 if (device) |
| 29 return device; | 34 return device; |
| 30 } | 35 } |
| 31 | 36 |
| 32 AudioMessageFilter* const filter = AudioMessageFilter::Get(); | 37 AudioMessageFilter* const filter = AudioMessageFilter::Get(); |
| 33 scoped_refptr<media::AudioOutputDevice> device = new media::AudioOutputDevice( | 38 scoped_refptr<media::AudioOutputDevice> device = new media::AudioOutputDevice( |
| 34 filter->CreateAudioOutputIPC(render_frame_id), filter->io_task_runner(), | 39 filter->CreateAudioOutputIPC(render_frame_id), filter->io_task_runner(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 55 AudioDeviceFactory::AudioDeviceFactory() { | 60 AudioDeviceFactory::AudioDeviceFactory() { |
| 56 DCHECK(!factory_) << "Can't register two factories at once."; | 61 DCHECK(!factory_) << "Can't register two factories at once."; |
| 57 factory_ = this; | 62 factory_ = this; |
| 58 } | 63 } |
| 59 | 64 |
| 60 AudioDeviceFactory::~AudioDeviceFactory() { | 65 AudioDeviceFactory::~AudioDeviceFactory() { |
| 61 factory_ = NULL; | 66 factory_ = NULL; |
| 62 } | 67 } |
| 63 | 68 |
| 64 } // namespace content | 69 } // namespace content |
| OLD | NEW |