| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void SetCallback(const AudioCallbackCombined& callback, void* user_data); | 60 void SetCallback(const AudioCallbackCombined& callback, void* user_data); |
| 61 | 61 |
| 62 // Configures the current state to be playing or not. The caller is | 62 // Configures the current state to be playing or not. The caller is |
| 63 // responsible for ensuring the new state is the opposite of the current one. | 63 // responsible for ensuring the new state is the opposite of the current one. |
| 64 // | 64 // |
| 65 // This is the implementation for PPB_Audio.Start/StopPlayback, except that | 65 // This is the implementation for PPB_Audio.Start/StopPlayback, except that |
| 66 // it does not actually notify the audio system to stop playback, it just | 66 // it does not actually notify the audio system to stop playback, it just |
| 67 // configures our object to stop generating callbacks. The actual stop | 67 // configures our object to stop generating callbacks. The actual stop |
| 68 // playback request will be done in the derived classes and will be different | 68 // playback request will be done in the derived classes and will be different |
| 69 // from the proxy and the renderer. | 69 // from the proxy and the renderer. |
| 70 void SetStartPlaybackState(); | 70 bool SetStartPlaybackState(); |
| 71 void SetStopPlaybackState(); | 71 void SetStopPlaybackState(); |
| 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 #if defined(OS_NACL) | 82 #if defined(OS_NACL) |
| 83 // NaCl has a special API for IRT code to create threads that can call back | 83 // NaCl has a special API for IRT code to create threads that can call back |
| 84 // into user code. | 84 // into user code. |
| 85 static void SetThreadFunctions(const struct PP_ThreadFunctions* functions); | 85 static void SetThreadFunctions(const struct PP_ThreadFunctions* functions); |
| 86 #endif | 86 #endif |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 // Starts execution of the audio thread. | 89 // Starts execution of the audio thread. |
| 90 void StartThread(); | 90 bool StartThread(); |
| 91 | 91 |
| 92 // Stop execution of the audio thread. | 92 // Stop execution of the audio thread. |
| 93 void StopThread(); | 93 void StopThread(); |
| 94 | 94 |
| 95 // DelegateSimpleThread::Delegate implementation. Run on the audio thread. | 95 // DelegateSimpleThread::Delegate implementation. Run on the audio thread. |
| 96 virtual void Run(); | 96 virtual void Run(); |
| 97 | 97 |
| 98 // True if playing the stream. | 98 // True if playing the stream. |
| 99 bool playing_; | 99 bool playing_; |
| 100 | 100 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // Buffer index used to coordinate with the browser side audio receiver. | 139 // Buffer index used to coordinate with the browser side audio receiver. |
| 140 uint32_t buffer_index_; | 140 uint32_t buffer_index_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared); | 142 DISALLOW_COPY_AND_ASSIGN(PPB_Audio_Shared); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace ppapi | 145 } // namespace ppapi |
| 146 | 146 |
| 147 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ | 147 #endif // PPAPI_SHARED_IMPL_PPB_AUDIO_SHARED_H_ |
| OLD | NEW |