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 "content/renderer/media/audio_message_filter.h" | 10 #include "content/renderer/media/audio_message_filter.h" |
11 #include "webkit/plugins/ppapi/plugin_delegate.h" | 11 #include "webkit/plugins/ppapi/plugin_delegate.h" |
12 | 12 |
13 namespace media{ | |
14 class AudioParameters; | 13 class AudioParameters; |
15 } | |
16 | 14 |
17 namespace base { | 15 namespace base { |
18 class MessageLoopProxy; | 16 class MessageLoopProxy; |
19 } | 17 } |
20 | 18 |
21 class PepperPlatformAudioOutputImpl | 19 class PepperPlatformAudioOutputImpl |
22 : public webkit::ppapi::PluginDelegate::PlatformAudioOutput, | 20 : public webkit::ppapi::PluginDelegate::PlatformAudioOutput, |
23 public AudioMessageFilter::Delegate, | 21 public AudioMessageFilter::Delegate, |
24 public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> { | 22 public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> { |
25 public: | 23 public: |
(...skipping 13 matching lines...) Expand all Loading... |
39 | 37 |
40 private: | 38 private: |
41 PepperPlatformAudioOutputImpl(); | 39 PepperPlatformAudioOutputImpl(); |
42 | 40 |
43 bool Initialize( | 41 bool Initialize( |
44 int sample_rate, | 42 int sample_rate, |
45 int frames_per_buffer, | 43 int frames_per_buffer, |
46 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client); | 44 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client); |
47 | 45 |
48 // I/O thread backends to above functions. | 46 // I/O thread backends to above functions. |
49 void InitializeOnIOThread(const media::AudioParameters& params); | 47 void InitializeOnIOThread(const AudioParameters& params); |
50 void StartPlaybackOnIOThread(); | 48 void StartPlaybackOnIOThread(); |
51 void StopPlaybackOnIOThread(); | 49 void StopPlaybackOnIOThread(); |
52 void ShutDownOnIOThread(); | 50 void ShutDownOnIOThread(); |
53 | 51 |
54 // AudioMessageFilter::Delegate. | 52 // AudioMessageFilter::Delegate. |
55 virtual void OnStateChanged(AudioStreamState state) OVERRIDE; | 53 virtual void OnStateChanged(AudioStreamState state) OVERRIDE; |
56 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 54 virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
57 base::SyncSocket::Handle socket_handle, | 55 base::SyncSocket::Handle socket_handle, |
58 uint32 length) OVERRIDE; | 56 uint32 length) OVERRIDE; |
59 | 57 |
60 // The client to notify when the stream is created. THIS MUST ONLY BE | 58 // The client to notify when the stream is created. THIS MUST ONLY BE |
61 // ACCESSED ON THE MAIN THREAD. | 59 // ACCESSED ON THE MAIN THREAD. |
62 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client_; | 60 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client_; |
63 | 61 |
64 // MessageFilter used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE | 62 // MessageFilter used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE |
65 // I/O thread except to send messages and get the message loop. | 63 // I/O thread except to send messages and get the message loop. |
66 scoped_refptr<AudioMessageFilter> filter_; | 64 scoped_refptr<AudioMessageFilter> filter_; |
67 | 65 |
68 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD | 66 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD |
69 // or else you could race with the initialize function which sets it. | 67 // or else you could race with the initialize function which sets it. |
70 int32 stream_id_; | 68 int32 stream_id_; |
71 | 69 |
72 base::MessageLoopProxy* main_message_loop_proxy_; | 70 base::MessageLoopProxy* main_message_loop_proxy_; |
73 | 71 |
74 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutputImpl); | 72 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutputImpl); |
75 }; | 73 }; |
76 | 74 |
77 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ | 75 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ |
OLD | NEW |