| 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/pepper/pepper_platform_audio_input.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_input.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "content/child/child_process.h" | 13 #include "content/child/child_process.h" |
| 14 #include "content/renderer/media/audio_input_message_filter.h" | 14 #include "content/renderer/media/audio_input_message_filter.h" |
| 15 #include "content/renderer/pepper/pepper_audio_input_host.h" | 15 #include "content/renderer/pepper/pepper_audio_input_host.h" |
| 16 #include "content/renderer/pepper/pepper_media_device_manager.h" | 16 #include "content/renderer/pepper/pepper_media_device_manager.h" |
| 17 #include "content/renderer/render_frame_impl.h" | 17 #include "content/renderer/render_frame_impl.h" |
| 18 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 19 #include "content/renderer/render_view_impl.h" | 19 #include "content/renderer/render_view_impl.h" |
| 20 #include "media/audio/audio_manager_base.h" | 20 #include "media/audio/audio_device_description.h" |
| 21 #include "ppapi/shared_impl/ppb_audio_config_shared.h" | 21 #include "ppapi/shared_impl/ppb_audio_config_shared.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 PepperPlatformAudioInput* PepperPlatformAudioInput::Create( | 27 PepperPlatformAudioInput* PepperPlatformAudioInput::Create( |
| 28 int render_frame_id, | 28 int render_frame_id, |
| 29 const std::string& device_id, | 29 const std::string& device_id, |
| 30 const GURL& document_url, | 30 const GURL& document_url, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 params_.Reset(media::AudioParameters::AUDIO_PCM_LINEAR, | 169 params_.Reset(media::AudioParameters::AUDIO_PCM_LINEAR, |
| 170 media::CHANNEL_LAYOUT_MONO, | 170 media::CHANNEL_LAYOUT_MONO, |
| 171 sample_rate, | 171 sample_rate, |
| 172 ppapi::kBitsPerAudioInputSample, | 172 ppapi::kBitsPerAudioInputSample, |
| 173 frames_per_buffer); | 173 frames_per_buffer); |
| 174 | 174 |
| 175 // We need to open the device and obtain the label and session ID before | 175 // We need to open the device and obtain the label and session ID before |
| 176 // initializing. | 176 // initializing. |
| 177 pending_open_device_id_ = GetMediaDeviceManager()->OpenDevice( | 177 pending_open_device_id_ = GetMediaDeviceManager()->OpenDevice( |
| 178 PP_DEVICETYPE_DEV_AUDIOCAPTURE, | 178 PP_DEVICETYPE_DEV_AUDIOCAPTURE, |
| 179 device_id.empty() ? media::AudioManagerBase::kDefaultDeviceId : device_id, | 179 device_id.empty() ? media::AudioDeviceDescription::kDefaultDeviceId |
| 180 : device_id, |
| 180 document_url, | 181 document_url, |
| 181 base::Bind(&PepperPlatformAudioInput::OnDeviceOpened, this)); | 182 base::Bind(&PepperPlatformAudioInput::OnDeviceOpened, this)); |
| 182 pending_open_device_ = true; | 183 pending_open_device_ = true; |
| 183 | 184 |
| 184 return true; | 185 return true; |
| 185 } | 186 } |
| 186 | 187 |
| 187 void PepperPlatformAudioInput::InitializeOnIOThread(int session_id) { | 188 void PepperPlatformAudioInput::InitializeOnIOThread(int session_id) { |
| 188 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 189 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| 189 | 190 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 PepperMediaDeviceManager* PepperPlatformAudioInput::GetMediaDeviceManager() { | 281 PepperMediaDeviceManager* PepperPlatformAudioInput::GetMediaDeviceManager() { |
| 281 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 282 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 282 | 283 |
| 283 RenderFrameImpl* const render_frame = | 284 RenderFrameImpl* const render_frame = |
| 284 RenderFrameImpl::FromRoutingID(render_frame_id_); | 285 RenderFrameImpl::FromRoutingID(render_frame_id_); |
| 285 return render_frame ? | 286 return render_frame ? |
| 286 PepperMediaDeviceManager::GetForRenderFrame(render_frame).get() : NULL; | 287 PepperMediaDeviceManager::GetForRenderFrame(render_frame).get() : NULL; |
| 287 } | 288 } |
| 288 | 289 |
| 289 } // namespace content | 290 } // namespace content |
| OLD | NEW |