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