OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ppapi/proxy/ppb_audio_input_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_input_proxy.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/threading/simple_thread.h" | 8 #include "base/threading/simple_thread.h" |
9 #include "ppapi/c/dev/ppb_audio_input_dev.h" | 9 #include "ppapi/c/dev/ppb_audio_input_dev.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 PPB_AudioInput_Callback audio_input_callback, | 133 PPB_AudioInput_Callback audio_input_callback, |
134 void* user_data) { | 134 void* user_data) { |
135 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); | 135 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id); |
136 if (!dispatcher) | 136 if (!dispatcher) |
137 return 0; | 137 return 0; |
138 | 138 |
139 EnterResourceNoLock<PPB_AudioConfig_API> config(config_id, true); | 139 EnterResourceNoLock<PPB_AudioConfig_API> config(config_id, true); |
140 if (config.failed()) | 140 if (config.failed()) |
141 return 0; | 141 return 0; |
142 | 142 |
| 143 if (!audio_input_callback) |
| 144 return 0; |
| 145 |
143 HostResource result; | 146 HostResource result; |
144 dispatcher->Send(new PpapiHostMsg_PPBAudioInput_Create( | 147 dispatcher->Send(new PpapiHostMsg_PPBAudioInput_Create( |
145 API_ID_PPB_AUDIO_INPUT_DEV, instance_id, | 148 API_ID_PPB_AUDIO_INPUT_DEV, instance_id, |
146 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(), | 149 config.object()->GetSampleRate(), config.object()->GetSampleFrameCount(), |
147 &result)); | 150 &result)); |
148 if (result.is_null()) | 151 if (result.is_null()) |
149 return 0; | 152 return 0; |
150 | 153 |
151 return (new AudioInput(result, config_id, audio_input_callback, | 154 return (new AudioInput(result, config_id, audio_input_callback, |
152 user_data))->GetReference(); | 155 user_data))->GetReference(); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( | 314 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( |
312 IntToPlatformFile(shared_memory_handle), false); | 315 IntToPlatformFile(shared_memory_handle), false); |
313 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) | 316 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) |
314 return PP_ERROR_FAILED; | 317 return PP_ERROR_FAILED; |
315 | 318 |
316 return PP_OK; | 319 return PP_OK; |
317 } | 320 } |
318 | 321 |
319 } // namespace proxy | 322 } // namespace proxy |
320 } // namespace ppapi | 323 } // namespace ppapi |
OLD | NEW |