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_INPUT_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/renderer/media/audio_input_message_filter.h" | 14 #include "content/renderer/media/audio_input_message_filter.h" |
15 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
16 #include "webkit/plugins/ppapi/plugin_delegate.h" | 16 #include "webkit/plugins/ppapi/plugin_delegate.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 class AudioParameters; | 19 class AudioParameters; |
20 } | 20 } |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
| 24 class AudioInputMessageFilter; |
24 class PepperPluginDelegateImpl; | 25 class PepperPluginDelegateImpl; |
25 | 26 |
26 // PepperPlatformAudioInputImpl is operated on two threads: the main thread (the | 27 // PepperPlatformAudioInputImpl is operated on two threads: the main thread (the |
27 // thread on which objects are created) and the I/O thread. All public methods, | 28 // thread on which objects are created) and the I/O thread. All public methods, |
28 // except the destructor, must be called on the main thread. The notifications | 29 // except the destructor, must be called on the main thread. The notifications |
29 // to the users of this class (via the PlatformAudioInputClient interface) are | 30 // to the users of this class (via the PlatformAudioInputClient interface) are |
30 // also sent on the main thread. Internally, this class sends audio input IPC | 31 // also sent on the main thread. Internally, this class sends audio input IPC |
31 // messages and receives media::AudioInputIPCDelegate notifications on the | 32 // messages and receives media::AudioInputIPCDelegate notifications on the |
32 // I/O thread. | 33 // I/O thread. |
33 | 34 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const std::string& label); | 87 const std::string& label); |
87 void CloseDevice(); | 88 void CloseDevice(); |
88 void NotifyStreamCreationFailed(); | 89 void NotifyStreamCreationFailed(); |
89 | 90 |
90 // The client to notify when the stream is created. THIS MUST ONLY BE | 91 // The client to notify when the stream is created. THIS MUST ONLY BE |
91 // ACCESSED ON THE MAIN THREAD. | 92 // ACCESSED ON THE MAIN THREAD. |
92 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client_; | 93 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client_; |
93 | 94 |
94 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE | 95 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE |
95 // I/O thread except to send messages and get the message loop. | 96 // I/O thread except to send messages and get the message loop. |
96 media::AudioInputIPC* ipc_; | 97 scoped_refptr<AudioInputMessageFilter> ipc_; |
97 | 98 |
98 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD | 99 // Our ID on the MessageFilter. THIS MUST ONLY BE ACCESSED ON THE I/O THREAD |
99 // or else you could race with the initialize function which sets it. | 100 // or else you could race with the initialize function which sets it. |
100 int32 stream_id_; | 101 int32 stream_id_; |
101 | 102 |
| 103 // The render view into which the audio is sent. |
| 104 int render_view_id_; |
| 105 |
102 base::MessageLoopProxy* main_message_loop_proxy_; | 106 base::MessageLoopProxy* main_message_loop_proxy_; |
103 | 107 |
104 // THIS MUST ONLY BE ACCESSED ON THE MAIN THREAD. | 108 // THIS MUST ONLY BE ACCESSED ON THE MAIN THREAD. |
105 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_; | 109 base::WeakPtr<PepperPluginDelegateImpl> plugin_delegate_; |
106 | 110 |
107 // The unique ID to identify the opened device. THIS MUST ONLY BE ACCESSED ON | 111 // The unique ID to identify the opened device. THIS MUST ONLY BE ACCESSED ON |
108 // THE MAIN THREAD. | 112 // THE MAIN THREAD. |
109 std::string label_; | 113 std::string label_; |
110 | 114 |
111 // Whether ShutDownOnIOThread() has been called. THIS MUST ONLY BE ACCESSED ON | 115 // Whether ShutDownOnIOThread() has been called. THIS MUST ONLY BE ACCESSED ON |
112 // THE I/O THREAD. | 116 // THE I/O THREAD. |
113 bool shutdown_called_; | 117 bool shutdown_called_; |
114 | 118 |
115 // Initialized on the main thread and accessed on the I/O thread afterwards. | 119 // Initialized on the main thread and accessed on the I/O thread afterwards. |
116 media::AudioParameters params_; | 120 media::AudioParameters params_; |
117 | 121 |
118 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl); | 122 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl); |
119 }; | 123 }; |
120 | 124 |
121 } // namespace content | 125 } // namespace content |
122 | 126 |
123 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ | 127 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ |
OLD | NEW |