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