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/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "base/sync_socket.h" | 10 #include "base/sync_socket.h" |
11 #include "base/threading/simple_thread.h" | 11 #include "base/threading/simple_thread.h" |
| 12 #include "media/base/audio_bus.h" |
12 #include "ppapi/c/ppb_audio.h" | 13 #include "ppapi/c/ppb_audio.h" |
13 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
14 #include "ppapi/thunk/ppb_audio_api.h" | 15 #include "ppapi/thunk/ppb_audio_api.h" |
15 | 16 |
16 #if defined(OS_NACL) | 17 #if defined(OS_NACL) |
17 #include "native_client/src/untrusted/irt/irt_ppapi.h" | 18 #include "native_client/src/untrusted/irt/irt_ppapi.h" |
18 #endif | 19 #endif |
19 | 20 |
20 namespace ppapi { | 21 namespace ppapi { |
21 | 22 |
(...skipping 24 matching lines...) Expand all Loading... |
46 // playback request will be done in the derived classes and will be different | 47 // playback request will be done in the derived classes and will be different |
47 // from the proxy and the renderer. | 48 // from the proxy and the renderer. |
48 void SetStartPlaybackState(); | 49 void SetStartPlaybackState(); |
49 void SetStopPlaybackState(); | 50 void SetStopPlaybackState(); |
50 | 51 |
51 // Sets the shared memory and socket handles. This will automatically start | 52 // Sets the shared memory and socket handles. This will automatically start |
52 // playback if we're currently set to play. | 53 // playback if we're currently set to play. |
53 void SetStreamInfo(PP_Instance instance, | 54 void SetStreamInfo(PP_Instance instance, |
54 base::SharedMemoryHandle shared_memory_handle, | 55 base::SharedMemoryHandle shared_memory_handle, |
55 size_t shared_memory_size, | 56 size_t shared_memory_size, |
56 base::SyncSocket::Handle socket_handle); | 57 base::SyncSocket::Handle socket_handle, |
| 58 int sample_frame_count); |
57 | 59 |
58 #if defined(OS_NACL) | 60 #if defined(OS_NACL) |
59 // NaCl has a special API for IRT code to create threads that can call back | 61 // NaCl has a special API for IRT code to create threads that can call back |
60 // into user code. | 62 // into user code. |
61 static void SetThreadFunctions(const struct PP_ThreadFunctions* functions); | 63 static void SetThreadFunctions(const struct PP_ThreadFunctions* functions); |
62 #endif | 64 #endif |
63 | 65 |
64 private: | 66 private: |
65 // Starts execution of the audio thread. | 67 // Starts execution of the audio thread. |
66 void StartThread(); | 68 void StartThread(); |
(...skipping 28 matching lines...) Expand all Loading... |
95 | 97 |
96 static void CallRun(void* self); | 98 static void CallRun(void* self); |
97 #endif | 99 #endif |
98 | 100 |
99 // Callback to call when audio is ready to accept new samples. | 101 // Callback to call when audio is ready to accept new samples. |
100 PPB_Audio_Callback callback_; | 102 PPB_Audio_Callback callback_; |
101 | 103 |
102 // User data pointer passed verbatim to the callback function. | 104 // User data pointer passed verbatim to the callback function. |
103 void* user_data_; | 105 void* user_data_; |
104 | 106 |
| 107 // AudioBus for shuttling data across the shared memory. |
| 108 scoped_ptr<media::AudioBus> audio_bus_; |
| 109 |
| 110 // Internal buffer for client's integer audio data. |
| 111 int client_buffer_size_bytes_; |
| 112 scoped_array<uint8_t> client_buffer_; |
| 113 |
105 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared); | 114 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared); |
106 }; | 115 }; |
107 | 116 |
108 } // namespace ppapi | 117 } // namespace ppapi |
109 | 118 |
110 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ | 119 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ |
OLD | NEW |