Chromium Code Reviews| 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 <string.h> | 5 #include <string.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 if (audio_input_0_1_ != 0) { | 107 if (audio_input_0_1_ != 0) { |
| 108 if (!audio_input_interface_0_1_->StartCapture(audio_input_0_1_)) | 108 if (!audio_input_interface_0_1_->StartCapture(audio_input_0_1_)) |
| 109 PostMessage(pp::Var("StartFailed")); | 109 PostMessage(pp::Var("StartFailed")); |
| 110 } else { | 110 } else { |
| 111 PostMessage(pp::Var("OpenFailed")); | 111 PostMessage(pp::Var("OpenFailed")); |
| 112 } | 112 } |
| 113 | 113 |
| 114 audio_input_ = pp::AudioInput_Dev(); | 114 audio_input_ = pp::AudioInput_Dev(); |
| 115 } else if (event == "Stop") { | 115 } else if (event == "Stop") { |
| 116 Stop(); | 116 Stop(); |
| 117 } else if (event == "Start") { | |
| 118 Start(); | |
| 117 } | 119 } |
| 118 } else if (message_data.is_number()) { | 120 } else if (message_data.is_number()) { |
| 119 int index = message_data.AsInt(); | 121 int index = message_data.AsInt(); |
| 120 if (index >= 0 && index < static_cast<int>(devices_.size())) { | 122 if (index >= 0 && index < static_cast<int>(devices_.size())) { |
| 121 Open(devices_[index]); | 123 Open(devices_[index]); |
| 122 } else { | 124 } else { |
| 123 PP_NOTREACHED(); | 125 PP_NOTREACHED(); |
| 124 } | 126 } |
| 125 } | 127 } |
| 126 } | 128 } |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 void Stop() { | 224 void Stop() { |
| 223 if (!audio_input_.is_null()) { | 225 if (!audio_input_.is_null()) { |
| 224 if (!audio_input_.StopCapture()) | 226 if (!audio_input_.StopCapture()) |
| 225 PostMessage(pp::Var("StopFailed")); | 227 PostMessage(pp::Var("StopFailed")); |
| 226 } else if (audio_input_0_1_ != 0) { | 228 } else if (audio_input_0_1_ != 0) { |
| 227 if (!audio_input_interface_0_1_->StopCapture(audio_input_0_1_)) | 229 if (!audio_input_interface_0_1_->StopCapture(audio_input_0_1_)) |
| 228 PostMessage(pp::Var("StopFailed")); | 230 PostMessage(pp::Var("StopFailed")); |
| 229 } | 231 } |
| 230 } | 232 } |
| 231 | 233 |
| 234 void Start() { | |
| 235 if (!audio_input_.is_null()) { | |
| 236 if (!audio_input_.StartCapture()) | |
|
no longer working on chromium
2012/03/18 00:38:59
hasn't this function been changed to void?
yzshen1
2012/03/19 21:47:54
We changed PlatformAudioInput::StartCapture() to r
| |
| 237 PostMessage(pp::Var("StartFailed")); | |
| 238 } else if (audio_input_0_1_ != 0) { | |
| 239 if (!audio_input_interface_0_1_->StartCapture(audio_input_0_1_)) | |
| 240 PostMessage(pp::Var("StartFailed")); | |
| 241 } | |
| 242 } | |
| 243 | |
| 232 void EnumerateDevicesFinished(int32_t result) { | 244 void EnumerateDevicesFinished(int32_t result) { |
| 233 static const char* const kDelimiter = "#__#"; | 245 static const char* const kDelimiter = "#__#"; |
| 234 | 246 |
| 235 if (result == PP_OK) { | 247 if (result == PP_OK) { |
| 236 std::string device_names; | 248 std::string device_names; |
| 237 for (size_t index = 0; index < devices_.size(); ++index) { | 249 for (size_t index = 0; index < devices_.size(); ++index) { |
| 238 pp::Var name = devices_[index].GetName(); | 250 pp::Var name = devices_[index].GetName(); |
| 239 PP_DCHECK(name.is_string()); | 251 PP_DCHECK(name.is_string()); |
| 240 | 252 |
| 241 if (index != 0) | 253 if (index != 0) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 }; | 299 }; |
| 288 | 300 |
| 289 namespace pp { | 301 namespace pp { |
| 290 | 302 |
| 291 // Factory function for your specialization of the Module object. | 303 // Factory function for your specialization of the Module object. |
| 292 Module* CreateModule() { | 304 Module* CreateModule() { |
| 293 return new MyModule(); | 305 return new MyModule(); |
| 294 } | 306 } |
| 295 | 307 |
| 296 } // namespace pp | 308 } // namespace pp |
| OLD | NEW |