OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_audio.h" | 5 #include "webkit/glue/plugins/pepper_audio.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ppapi/c/dev/ppb_audio_dev.h" | 8 #include "ppapi/c/dev/ppb_audio_dev.h" |
9 #include "ppapi/c/dev/ppb_audio_trusted_dev.h" | 9 #include "ppapi/c/dev/ppb_audio_trusted_dev.h" |
10 #include "ppapi/c/pp_completion_callback.h" | 10 #include "ppapi/c/pp_completion_callback.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { | 147 int32_t GetSyncSocket(PP_Resource audio_id, int* sync_socket) { |
148 scoped_refptr<Audio> audio = Resource::GetAs<Audio>(audio_id); | 148 scoped_refptr<Audio> audio = Resource::GetAs<Audio>(audio_id); |
149 if (audio) | 149 if (audio) |
150 return audio->GetSyncSocket(sync_socket); | 150 return audio->GetSyncSocket(sync_socket); |
151 return PP_ERROR_BADRESOURCE; | 151 return PP_ERROR_BADRESOURCE; |
152 } | 152 } |
153 | 153 |
154 int32_t GetSharedMemory(PP_Resource audio_id, | 154 int32_t GetSharedMemory(PP_Resource audio_id, |
155 int* shm_handle, | 155 int* shm_handle, |
156 int32_t* shm_size) { | 156 uint32_t* shm_size) { |
157 scoped_refptr<Audio> audio = Resource::GetAs<Audio>(audio_id); | 157 scoped_refptr<Audio> audio = Resource::GetAs<Audio>(audio_id); |
158 if (audio) | 158 if (audio) |
159 return audio->GetSharedMemory(shm_handle, shm_size); | 159 return audio->GetSharedMemory(shm_handle, shm_size); |
160 return PP_ERROR_BADRESOURCE; | 160 return PP_ERROR_BADRESOURCE; |
161 } | 161 } |
162 | 162 |
163 const PPB_AudioTrusted_Dev ppb_audiotrusted = { | 163 const PPB_AudioTrusted_Dev ppb_audiotrusted = { |
164 &CreateTrusted, | 164 &CreateTrusted, |
165 &Open, | 165 &Open, |
166 &GetSyncSocket, | 166 &GetSyncSocket, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 #elif defined(OS_WIN) | 293 #elif defined(OS_WIN) |
294 *sync_socket = reinterpret_cast<int>(socket_->handle()); | 294 *sync_socket = reinterpret_cast<int>(socket_->handle()); |
295 #else | 295 #else |
296 #error "Platform not supported." | 296 #error "Platform not supported." |
297 #endif | 297 #endif |
298 return PP_OK; | 298 return PP_OK; |
299 } | 299 } |
300 return PP_ERROR_FAILED; | 300 return PP_ERROR_FAILED; |
301 } | 301 } |
302 | 302 |
303 int32_t Audio::GetSharedMemory(int* shm_handle, int32_t* shm_size) { | 303 int32_t Audio::GetSharedMemory(int* shm_handle, uint32_t* shm_size) { |
304 if (shared_memory_ != NULL) { | 304 if (shared_memory_ != NULL) { |
305 #if defined(OS_POSIX) | 305 #if defined(OS_POSIX) |
306 *shm_handle = shared_memory_->handle().fd; | 306 *shm_handle = shared_memory_->handle().fd; |
307 #elif defined(OS_WIN) | 307 #elif defined(OS_WIN) |
308 *shm_handle = reinterpret_cast<int>(shared_memory_->handle()); | 308 *shm_handle = reinterpret_cast<int>(shared_memory_->handle()); |
309 #else | 309 #else |
310 #error "Platform not supported." | 310 #error "Platform not supported." |
311 #endif | 311 #endif |
312 *shm_size = shared_memory_size_; | 312 *shm_size = shared_memory_size_; |
313 return PP_OK; | 313 return PP_OK; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 socket_->Receive(&pending_data, sizeof(pending_data)) && | 380 socket_->Receive(&pending_data, sizeof(pending_data)) && |
381 pending_data >= 0) { | 381 pending_data >= 0) { |
382 // Exit the thread on pause. | 382 // Exit the thread on pause. |
383 if (pending_data < 0) | 383 if (pending_data < 0) |
384 return; | 384 return; |
385 callback_(buffer, buffer_size_in_bytes, user_data_); | 385 callback_(buffer, buffer_size_in_bytes, user_data_); |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 } // namespace pepper | 389 } // namespace pepper |
OLD | NEW |