Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_output_impl.h

Issue 10790121: First step towards moving AudioDevice from content/ to media/audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unnecessary #include Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "media/audio/audio_device_ipc.h"
11 #include "webkit/plugins/ppapi/plugin_delegate.h" 11 #include "webkit/plugins/ppapi/plugin_delegate.h"
12 12
13 namespace media{ 13 namespace media{
14 class AudioParameters; 14 class AudioParameters;
15 } 15 }
16 16
17 namespace base { 17 namespace base {
18 class MessageLoopProxy; 18 class MessageLoopProxy;
19 } 19 }
20 20
21 namespace content { 21 namespace content {
22 22
23 class PepperPlatformAudioOutputImpl 23 class PepperPlatformAudioOutputImpl
24 : public webkit::ppapi::PluginDelegate::PlatformAudioOutput, 24 : public webkit::ppapi::PluginDelegate::PlatformAudioOutput,
25 public AudioMessageFilter::Delegate, 25 public media::AudioDeviceIPCDelegate,
26 public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> { 26 public base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl> {
27 public: 27 public:
28 // Factory function, returns NULL on failure. StreamCreated() will be called 28 // Factory function, returns NULL on failure. StreamCreated() will be called
29 // when the stream is created. 29 // when the stream is created.
30 static PepperPlatformAudioOutputImpl* Create( 30 static PepperPlatformAudioOutputImpl* Create(
31 int sample_rate, 31 int sample_rate,
32 int frames_per_buffer, 32 int frames_per_buffer,
33 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client); 33 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client);
34 34
35 // PlatformAudioOutput implementation (called on main thread). 35 // PlatformAudioOutput implementation (called on main thread).
36 virtual bool StartPlayback() OVERRIDE; 36 virtual bool StartPlayback() OVERRIDE;
37 virtual bool StopPlayback() OVERRIDE; 37 virtual bool StopPlayback() OVERRIDE;
38 virtual void ShutDown() OVERRIDE; 38 virtual void ShutDown() OVERRIDE;
39 39
40 // AudioMessageFilter::Delegate. 40 // AudioMessageFilter::Delegate.
scherkus (not reviewing) 2012/07/23 22:57:51 update docs
tommi (sloooow) - chröme 2012/07/24 09:49:44 Done.
41 virtual void OnStateChanged(AudioStreamState state) OVERRIDE; 41 virtual void OnStateChanged(media::AudioStreamState state) OVERRIDE;
42 virtual void OnStreamCreated(base::SharedMemoryHandle handle, 42 virtual void OnStreamCreated(base::SharedMemoryHandle handle,
43 base::SyncSocket::Handle socket_handle, 43 base::SyncSocket::Handle socket_handle,
44 uint32 length) OVERRIDE; 44 uint32 length) OVERRIDE;
45 45
46 protected: 46 protected:
47 virtual ~PepperPlatformAudioOutputImpl(); 47 virtual ~PepperPlatformAudioOutputImpl();
48 48
49 private: 49 private:
50 friend class base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl>; 50 friend class base::RefCountedThreadSafe<PepperPlatformAudioOutputImpl>;
51 51
52 PepperPlatformAudioOutputImpl(); 52 PepperPlatformAudioOutputImpl();
53 53
54 bool Initialize( 54 bool Initialize(
55 int sample_rate, 55 int sample_rate,
56 int frames_per_buffer, 56 int frames_per_buffer,
57 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client); 57 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client);
58 58
59 // I/O thread backends to above functions. 59 // I/O thread backends to above functions.
60 void InitializeOnIOThread(const media::AudioParameters& params); 60 void InitializeOnIOThread(const media::AudioParameters& params);
61 void StartPlaybackOnIOThread(); 61 void StartPlaybackOnIOThread();
62 void StopPlaybackOnIOThread(); 62 void StopPlaybackOnIOThread();
63 void ShutDownOnIOThread(); 63 void ShutDownOnIOThread();
64 64
65 // The client to notify when the stream is created. THIS MUST ONLY BE 65 // The client to notify when the stream is created. THIS MUST ONLY BE
66 // ACCESSED ON THE MAIN THREAD. 66 // ACCESSED ON THE MAIN THREAD.
67 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client_; 67 webkit::ppapi::PluginDelegate::PlatformAudioOutputClient* client_;
68 68
69 // MessageFilter used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE 69 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE
70 // I/O thread except to send messages and get the message loop. 70 // I/O thread except to send messages and get the message loop.
71 scoped_refptr<AudioMessageFilter> filter_; 71 media::AudioDeviceIPC* ipc_;
72 72
73 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD 73 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD
74 // or else you could race with the initialize function which sets it. 74 // or else you could race with the initialize function which sets it.
75 int32 stream_id_; 75 int32 stream_id_;
76 76
77 base::MessageLoopProxy* main_message_loop_proxy_; 77 base::MessageLoopProxy* main_message_loop_proxy_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutputImpl); 79 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioOutputImpl);
80 }; 80 };
81 81
82 } // namespace content 82 } // namespace content
83 83
84 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_ 84 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_OUTPUT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698