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/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.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 "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 class AudioParameters; | 19 class AudioParameters; |
| 20 } |
| 21 |
19 class PepperPluginDelegateImpl; | 22 class PepperPluginDelegateImpl; |
20 | 23 |
21 // PepperPlatformAudioInputImpl is operated on two threads: the main thread (the | 24 // PepperPlatformAudioInputImpl is operated on two threads: the main thread (the |
22 // thread on which objects are created) and the I/O thread. All public methods, | 25 // thread on which objects are created) and the I/O thread. All public methods, |
23 // except the destructor, must be called on the main thread. The notifications | 26 // except the destructor, must be called on the main thread. The notifications |
24 // to the users of this class (via the PlatformAudioInputClient interface) are | 27 // to the users of this class (via the PlatformAudioInputClient interface) are |
25 // also sent on the main thread. Internally, this class sends audio input IPC | 28 // also sent on the main thread. Internally, this class sends audio input IPC |
26 // messages and receives AudioInputMessageFilter::Delegate notifications on the | 29 // messages and receives AudioInputMessageFilter::Delegate notifications on the |
27 // I/O thread. | 30 // I/O thread. |
| 31 |
28 class PepperPlatformAudioInputImpl | 32 class PepperPlatformAudioInputImpl |
29 : public webkit::ppapi::PluginDelegate::PlatformAudioInput, | 33 : public webkit::ppapi::PluginDelegate::PlatformAudioInput, |
30 public AudioInputMessageFilter::Delegate, | 34 public AudioInputMessageFilter::Delegate, |
31 public base::RefCountedThreadSafe<PepperPlatformAudioInputImpl> { | 35 public base::RefCountedThreadSafe<PepperPlatformAudioInputImpl> { |
32 public: | 36 public: |
33 virtual ~PepperPlatformAudioInputImpl(); | 37 virtual ~PepperPlatformAudioInputImpl(); |
34 | 38 |
35 // Factory function, returns NULL on failure. StreamCreated() will be called | 39 // Factory function, returns NULL on failure. StreamCreated() will be called |
36 // when the stream is created. | 40 // when the stream is created. |
37 static PepperPlatformAudioInputImpl* Create( | 41 static PepperPlatformAudioInputImpl* Create( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 99 |
96 // The unique ID to identify the opened device. THIS MUST ONLY BE ACCESSED ON | 100 // The unique ID to identify the opened device. THIS MUST ONLY BE ACCESSED ON |
97 // THE MAIN THREAD. | 101 // THE MAIN THREAD. |
98 std::string label_; | 102 std::string label_; |
99 | 103 |
100 // Whether ShutDownOnIOThread() has been called. THIS MUST ONLY BE ACCESSED ON | 104 // Whether ShutDownOnIOThread() has been called. THIS MUST ONLY BE ACCESSED ON |
101 // THE I/O THREAD. | 105 // THE I/O THREAD. |
102 bool shutdown_called_; | 106 bool shutdown_called_; |
103 | 107 |
104 // Initialized on the main thread and accessed on the I/O thread afterwards. | 108 // Initialized on the main thread and accessed on the I/O thread afterwards. |
105 AudioParameters params_; | 109 media::AudioParameters params_; |
106 | 110 |
107 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl); | 111 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl); |
108 }; | 112 }; |
109 | 113 |
110 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ | 114 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ |
OLD | NEW |