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