| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 // Make sure we don't call init more than once. | 122 // Make sure we don't call init more than once. |
| 123 DCHECK_EQ(0, stream_id_); | 123 DCHECK_EQ(0, stream_id_); |
| 124 stream_id_ = filter_->AddDelegate(this); | 124 stream_id_ = filter_->AddDelegate(this); |
| 125 DCHECK_NE(0, stream_id_); | 125 DCHECK_NE(0, stream_id_); |
| 126 | 126 |
| 127 if (!session_id) { | 127 if (!session_id) { |
| 128 // We will be notified by OnStreamCreated(). | 128 // We will be notified by OnStreamCreated(). |
| 129 filter_->Send(new AudioInputHostMsg_CreateStream( | 129 filter_->Send(new AudioInputHostMsg_CreateStream( |
| 130 stream_id_, params_, AudioManagerBase::kDefaultDeviceId)); | 130 stream_id_, params_, AudioManagerBase::kDefaultDeviceId, false)); |
| 131 } else { | 131 } else { |
| 132 // We will be notified by OnDeviceReady(). | 132 // We will be notified by OnDeviceReady(). |
| 133 filter_->Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id)); | 133 filter_->Send(new AudioInputHostMsg_StartDevice(stream_id_, session_id)); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 void PepperPlatformAudioInputImpl::StartCaptureOnIOThread() { | 137 void PepperPlatformAudioInputImpl::StartCaptureOnIOThread() { |
| 138 DCHECK(ChildProcess::current()->io_message_loop_proxy()-> | 138 DCHECK(ChildProcess::current()->io_message_loop_proxy()-> |
| 139 BelongsToCurrentThread()); | 139 BelongsToCurrentThread()); |
| 140 | 140 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 return; | 222 return; |
| 223 | 223 |
| 224 if (device_id.empty()) { | 224 if (device_id.empty()) { |
| 225 main_message_loop_proxy_->PostTask( | 225 main_message_loop_proxy_->PostTask( |
| 226 FROM_HERE, | 226 FROM_HERE, |
| 227 base::Bind(&PepperPlatformAudioInputImpl::NotifyStreamCreationFailed, | 227 base::Bind(&PepperPlatformAudioInputImpl::NotifyStreamCreationFailed, |
| 228 this)); | 228 this)); |
| 229 } else { | 229 } else { |
| 230 // We will be notified by OnStreamCreated(). | 230 // We will be notified by OnStreamCreated(). |
| 231 filter_->Send(new AudioInputHostMsg_CreateStream(stream_id_, params_, | 231 filter_->Send(new AudioInputHostMsg_CreateStream(stream_id_, params_, |
| 232 device_id)); | 232 device_id, false)); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 void PepperPlatformAudioInputImpl::OnDeviceOpened(int request_id, | 236 void PepperPlatformAudioInputImpl::OnDeviceOpened(int request_id, |
| 237 bool succeeded, | 237 bool succeeded, |
| 238 const std::string& label) { | 238 const std::string& label) { |
| 239 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); | 239 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); |
| 240 | 240 |
| 241 if (succeeded && plugin_delegate_) { | 241 if (succeeded && plugin_delegate_) { |
| 242 DCHECK(!label.empty()); | 242 DCHECK(!label.empty()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 266 label_.clear(); | 266 label_.clear(); |
| 267 } | 267 } |
| 268 } | 268 } |
| 269 | 269 |
| 270 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { | 270 void PepperPlatformAudioInputImpl::NotifyStreamCreationFailed() { |
| 271 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); | 271 DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); |
| 272 | 272 |
| 273 if (client_) | 273 if (client_) |
| 274 client_->StreamCreationFailed(); | 274 client_->StreamCreationFailed(); |
| 275 } | 275 } |
| OLD | NEW |