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 #ifndef PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ |
6 #define PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/sync_socket.h" | 10 #include "base/sync_socket.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Sets the shared memory and socket handles. This will automatically start | 73 // Sets the shared memory and socket handles. This will automatically start |
74 // playback if we're currently set to play. | 74 // playback if we're currently set to play. |
75 void SetStreamInfo(PP_Instance instance, | 75 void SetStreamInfo(PP_Instance instance, |
76 base::SharedMemoryHandle shared_memory_handle, | 76 base::SharedMemoryHandle shared_memory_handle, |
77 size_t shared_memory_size, | 77 size_t shared_memory_size, |
78 base::SyncSocket::Handle socket_handle, | 78 base::SyncSocket::Handle socket_handle, |
79 PP_AudioSampleRate sample_rate, | 79 PP_AudioSampleRate sample_rate, |
80 int sample_frame_count); | 80 int sample_frame_count); |
81 | 81 |
| 82 // Returns whether a thread can be created on the client context. |
| 83 // In trusted plugin, this should always return true, as it uses Chrome's |
| 84 // thread library. In NaCl plugin, this returns whether SetThreadFunctions |
| 85 // was invoked properly. |
| 86 static bool IsThreadFunctionReady(); |
| 87 |
82 #if defined(OS_NACL) | 88 #if defined(OS_NACL) |
83 // NaCl has a special API for IRT code to create threads that can call back | 89 // NaCl has a special API for IRT code to create threads that can call back |
84 // into user code. | 90 // into user code. |
85 static void SetThreadFunctions(const struct PP_ThreadFunctions* functions); | 91 static void SetThreadFunctions(const struct PP_ThreadFunctions* functions); |
86 #endif | 92 #endif |
87 | 93 |
88 private: | 94 private: |
89 // Starts execution of the audio thread. | 95 // Starts execution of the audio thread. |
90 void StartThread(); | 96 void StartThread(); |
91 | 97 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 144 |
139 // Buffer index used to coordinate with the browser side audio receiver. | 145 // Buffer index used to coordinate with the browser side audio receiver. |
140 uint32_t buffer_index_; | 146 uint32_t buffer_index_; |
141 | 147 |
142 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared); | 148 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared); |
143 }; | 149 }; |
144 | 150 |
145 } // namespace ppapi | 151 } // namespace ppapi |
146 | 152 |
147 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ | 153 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ |
OLD | NEW |