| 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" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 if (!GetMediaDeviceManager()) | 162 if (!GetMediaDeviceManager()) |
| 163 return false; | 163 return false; |
| 164 | 164 |
| 165 ipc_ = RenderThreadImpl::current() | 165 ipc_ = RenderThreadImpl::current() |
| 166 ->audio_input_message_filter() | 166 ->audio_input_message_filter() |
| 167 ->CreateAudioInputIPC(render_frame_id); | 167 ->CreateAudioInputIPC(render_frame_id); |
| 168 | 168 |
| 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 ppapi::kAudioInputChannels, | |
| 172 sample_rate, | 171 sample_rate, |
| 173 ppapi::kBitsPerAudioInputSample, | 172 ppapi::kBitsPerAudioInputSample, |
| 174 frames_per_buffer); | 173 frames_per_buffer); |
| 175 | 174 |
| 176 // 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 |
| 177 // initializing. | 176 // initializing. |
| 178 pending_open_device_id_ = GetMediaDeviceManager()->OpenDevice( | 177 pending_open_device_id_ = GetMediaDeviceManager()->OpenDevice( |
| 179 PP_DEVICETYPE_DEV_AUDIOCAPTURE, | 178 PP_DEVICETYPE_DEV_AUDIOCAPTURE, |
| 180 device_id.empty() ? media::AudioManagerBase::kDefaultDeviceId : device_id, | 179 device_id.empty() ? media::AudioManagerBase::kDefaultDeviceId : device_id, |
| 181 document_url, | 180 document_url, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 PepperMediaDeviceManager* PepperPlatformAudioInput::GetMediaDeviceManager() { | 280 PepperMediaDeviceManager* PepperPlatformAudioInput::GetMediaDeviceManager() { |
| 282 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 281 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 283 | 282 |
| 284 RenderFrameImpl* const render_frame = | 283 RenderFrameImpl* const render_frame = |
| 285 RenderFrameImpl::FromRoutingID(render_frame_id_); | 284 RenderFrameImpl::FromRoutingID(render_frame_id_); |
| 286 return render_frame ? | 285 return render_frame ? |
| 287 PepperMediaDeviceManager::GetForRenderFrame(render_frame).get() : NULL; | 286 PepperMediaDeviceManager::GetForRenderFrame(render_frame).get() : NULL; |
| 288 } | 287 } |
| 289 | 288 |
| 290 } // namespace content | 289 } // namespace content |
| OLD | NEW |