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 "ppapi/proxy/ppb_audio_proxy.h" | 5 #include "ppapi/proxy/ppb_audio_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 "media/audio/shared_memory_util.h" | 9 #include "media/audio/shared_memory_util.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, | 173 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, |
174 OnMsgStartOrStop) | 174 OnMsgStartOrStop) |
175 #endif | 175 #endif |
176 IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, | 176 IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, |
177 OnMsgNotifyAudioStreamCreated) | 177 OnMsgNotifyAudioStreamCreated) |
178 IPC_MESSAGE_UNHANDLED(handled = false) | 178 IPC_MESSAGE_UNHANDLED(handled = false) |
179 IPC_END_MESSAGE_MAP() | 179 IPC_END_MESSAGE_MAP() |
180 return handled; | 180 return handled; |
181 } | 181 } |
182 | 182 |
| 183 #if !defined(OS_NACL) |
183 void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, | 184 void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, |
184 int32_t sample_rate, | 185 int32_t sample_rate, |
185 uint32_t sample_frame_count, | 186 uint32_t sample_frame_count, |
186 HostResource* result) { | 187 HostResource* result) { |
187 thunk::EnterResourceCreation resource_creation(instance_id); | 188 thunk::EnterResourceCreation resource_creation(instance_id); |
188 if (resource_creation.failed()) | 189 if (resource_creation.failed()) |
189 return; | 190 return; |
190 | 191 |
191 // Make the resource and get the API pointer to its trusted interface. | 192 // Make the resource and get the API pointer to its trusted interface. |
192 result->SetHostResource( | 193 result->SetHostResource( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 return result; | 306 return result; |
306 | 307 |
307 // shared_memory_handle doesn't belong to us: don't close it. | 308 // shared_memory_handle doesn't belong to us: don't close it. |
308 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( | 309 *foreign_shared_memory_handle = dispatcher()->ShareHandleWithRemote( |
309 IntToPlatformFile(shared_memory_handle), false); | 310 IntToPlatformFile(shared_memory_handle), false); |
310 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) | 311 if (*foreign_shared_memory_handle == IPC::InvalidPlatformFileForTransit()) |
311 return PP_ERROR_FAILED; | 312 return PP_ERROR_FAILED; |
312 | 313 |
313 return PP_OK; | 314 return PP_OK; |
314 } | 315 } |
| 316 #endif // !defined(OS_NACL) |
315 | 317 |
316 // Processed in the plugin (message from host). | 318 // Processed in the plugin (message from host). |
317 void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( | 319 void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( |
318 const HostResource& audio_id, | 320 const HostResource& audio_id, |
319 int32_t result_code, | 321 int32_t result_code, |
320 SerializedHandle socket_handle, | 322 SerializedHandle socket_handle, |
321 SerializedHandle handle) { | 323 SerializedHandle handle) { |
322 CHECK(socket_handle.is_socket()); | 324 CHECK(socket_handle.is_socket()); |
323 CHECK(handle.is_shmem()); | 325 CHECK(handle.is_shmem()); |
324 EnterPluginFromHostResource<PPB_Audio_API> enter(audio_id); | 326 EnterPluginFromHostResource<PPB_Audio_API> enter(audio_id); |
(...skipping 14 matching lines...) Expand all Loading... |
339 static_cast<Audio*>(enter.object())->SetStreamInfo( | 341 static_cast<Audio*>(enter.object())->SetStreamInfo( |
340 enter.resource()->pp_instance(), handle.shmem(), | 342 enter.resource()->pp_instance(), handle.shmem(), |
341 media::PacketSizeInBytes(handle.size()), | 343 media::PacketSizeInBytes(handle.size()), |
342 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), | 344 IPC::PlatformFileForTransitToPlatformFile(socket_handle.descriptor()), |
343 config.object()->GetSampleFrameCount()); | 345 config.object()->GetSampleFrameCount()); |
344 } | 346 } |
345 } | 347 } |
346 | 348 |
347 } // namespace proxy | 349 } // namespace proxy |
348 } // namespace ppapi | 350 } // namespace ppapi |
OLD | NEW |