| 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 CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ |
| 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "media/audio/audio_output_ipc.h" | 11 #include "media/audio/audio_output_ipc.h" |
| 11 #include "webkit/plugins/ppapi/plugin_delegate.h" | 12 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 12 | 13 |
| 13 namespace media { | 14 namespace media { |
| 14 class AudioParameters; | 15 class AudioParameters; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class MessageLoopProxy; | 19 class MessageLoopProxy; |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 | 23 |
| 23 class AudioMessageFilter; | |
| 24 | |
| 25 class PepperPlatformAudioOutputImpl | 24 class PepperPlatformAudioOutputImpl |
| 26 : public webkit::ppapi::PluginDelegate::PlatformAudioOutput, | 25 : public webkit::ppapi::PluginDelegate::PlatformAudioOutput, |
| 27 public media::AudioOutputIPCDelegate, | 26 public media::AudioOutputIPCDelegate, |
| 28 public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> { | 27 public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> { |
| 29 public: | 28 public: |
| 30 // Factory function, returns NULL on failure. StreamCreated() will be called | 29 // Factory function, returns NULL on failure. StreamCreated() will be called |
| 31 // when the stream is created. | 30 // when the stream is created. |
| 32 static PepperPlatformAudioOutputImpl* Create( | 31 static PepperPlatformAudioOutputImpl* Create( |
| 33 int sample_rate, | 32 int sample_rate, |
| 34 int frames_per_buffer, | 33 int frames_per_buffer, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 | 55 |
| 57 PepperPlatformAudioOutputImpl(); | 56 PepperPlatformAudioOutputImpl(); |
| 58 | 57 |
| 59 bool Initialize( | 58 bool Initialize( |
| 60 int sample_rate, | 59 int sample_rate, |
| 61 int frames_per_buffer, | 60 int frames_per_buffer, |
| 62 int source_render_view_id, | 61 int source_render_view_id, |
| 63 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client); | 62 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client); |
| 64 | 63 |
| 65 // I/O thread backends to above functions. | 64 // I/O thread backends to above functions. |
| 66 void InitializeOnIOThread(const media::AudioParameters& params, | 65 void InitializeOnIOThread(const media::AudioParameters& params); |
| 67 int source_render_view_id); | |
| 68 void StartPlaybackOnIOThread(); | 66 void StartPlaybackOnIOThread(); |
| 69 void StopPlaybackOnIOThread(); | 67 void StopPlaybackOnIOThread(); |
| 70 void ShutDownOnIOThread(); | 68 void ShutDownOnIOThread(); |
| 71 | 69 |
| 72 // The client to notify when the stream is created. THIS MUST ONLY BE | 70 // The client to notify when the stream is created. THIS MUST ONLY BE |
| 73 // ACCESSED ON THE MAIN THREAD. | 71 // ACCESSED ON THE MAIN THREAD. |
| 74 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client_; | 72 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client_; |
| 75 | 73 |
| 76 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE | 74 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE |
| 77 // I/O thread except to send messages and get the message loop. | 75 // I/O thread except to send messages and get the message loop. |
| 78 scoped_refptr<AudioMessageFilter> ipc_; | 76 scoped_ptr<media::AudioOutputIPC> ipc_; |
| 79 | |
| 80 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD | |
| 81 // or else you could race with the initialize function which sets it. | |
| 82 int32 stream_id_; | |
| 83 | 77 |
| 84 base::MessageLoopProxy* main_message_loop_proxy_; | 78 base::MessageLoopProxy* main_message_loop_proxy_; |
| 85 | 79 |
| 86 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutputImpl); | 80 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutputImpl); |
| 87 }; | 81 }; |
| 88 | 82 |
| 89 } // namespace content | 83 } // namespace content |
| 90 | 84 |
| 91 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ | 85 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ |
| OLD | NEW |