| 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_impl.h" | 5 #include "content/renderer/pepper/pepper_platform_audio_input_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 int frames_per_buffer, | 150 int frames_per_buffer, |
| 151 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) { | 151 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client) { |
| 152 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); | 152 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); |
| 153 | 153 |
| 154 if (!plugin_delegate || !client) | 154 if (!plugin_delegate || !client) |
| 155 return false; | 155 return false; |
| 156 | 156 |
| 157 plugin_delegate_ = plugin_delegate; | 157 plugin_delegate_ = plugin_delegate; |
| 158 client_ = client; | 158 client_ = client; |
| 159 | 159 |
| 160 params_.Reset(media::AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, | 160 params_.Reset(media::AudioParameters::AUDIO_PCM_LINEAR, |
| 161 sample_rate, 16, frames_per_buffer); | 161 media::CHANNEL_LAYOUT_MONO, sample_rate, 16, frames_per_buffer); |
| 162 | 162 |
| 163 if (device_id.empty()) { | 163 if (device_id.empty()) { |
| 164 // Use the default device. | 164 // Use the default device. |
| 165 ChildProcess::current()->io_message_loop()->PostTask( | 165 ChildProcess::current()->io_message_loop()->PostTask( |
| 166 FROM_HERE, | 166 FROM_HERE, |
| 167 base::Bind(&PepperPlatformAudioInputImpl::InitializeOnIOThread, | 167 base::Bind(&PepperPlatformAudioInputImpl::InitializeOnIOThread, |
| 168 this, 0)); | 168 this, 0)); |
| 169 } else { | 169 } else { |
| 170 // We need to open the device and obtain the label and session ID before | 170 // We need to open the device and obtain the label and session ID before |
| 171 // initializing. | 171 // initializing. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 | 274 |
| 275 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { | 275 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { |
| 276 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); | 276 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); |
| 277 | 277 |
| 278 if (client_) | 278 if (client_) |
| 279 client_->StreamCreationFailed(); | 279 client_->StreamCreationFailed(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace content | 282 } // namespace content |
| OLD | NEW |