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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // to the users of this class (via the PlatformAudioInputClient interface) are | 29 // 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 | 30 // also sent on the main thread. Internally, this class sends audio input IPC |
31 // messages and receives AudioInputMessageFilter::Delegate notifications on the | 31 // messages and receives AudioInputMessageFilter::Delegate notifications on the |
32 // I/O thread. | 32 // I/O thread. |
33 | 33 |
34 class PepperPlatformAudioInputImpl | 34 class PepperPlatformAudioInputImpl |
35 : public webkit::ppapi::PluginDelegate::PlatformAudioInput, | 35 : public webkit::ppapi::PluginDelegate::PlatformAudioInput, |
36 public AudioInputMessageFilter::Delegate, | 36 public AudioInputMessageFilter::Delegate, |
37 public base::RefCountedThreadSafe<PepperPlatformAudioInputImpl> { | 37 public base::RefCountedThreadSafe<PepperPlatformAudioInputImpl> { |
38 public: | 38 public: |
39 virtual ~PepperPlatformAudioInputImpl(); | |
40 | |
41 // Factory function, returns NULL on failure. StreamCreated() will be called | 39 // Factory function, returns NULL on failure. StreamCreated() will be called |
42 // when the stream is created. | 40 // when the stream is created. |
43 static PepperPlatformAudioInputImpl* Create( | 41 static PepperPlatformAudioInputImpl* Create( |
44 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, | 42 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, |
45 const std::string& device_id, | 43 const std::string& device_id, |
46 int sample_rate, | 44 int sample_rate, |
47 int frames_per_buffer, | 45 int frames_per_buffer, |
48 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client); | 46 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client); |
49 | 47 |
50 // PlatformAudioInput implementation (called on main thread). | 48 // PlatformAudioInput implementation (called on main thread). |
51 virtual void StartCapture() OVERRIDE; | 49 virtual void StartCapture() OVERRIDE; |
52 virtual void StopCapture() OVERRIDE; | 50 virtual void StopCapture() OVERRIDE; |
53 virtual void ShutDown() OVERRIDE; | 51 virtual void ShutDown() OVERRIDE; |
54 | 52 |
55 private: | 53 private: |
| 54 friend class base::RefCountedThreadSafe<PepperPlatformAudioInputImpl>; |
| 55 |
56 PepperPlatformAudioInputImpl(); | 56 PepperPlatformAudioInputImpl(); |
| 57 virtual ~PepperPlatformAudioInputImpl(); |
57 | 58 |
58 bool Initialize( | 59 bool Initialize( |
59 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, | 60 const base::WeakPtr<PepperPluginDelegateImpl>& plugin_delegate, |
60 const std::string& device_id, | 61 const std::string& device_id, |
61 int sample_rate, | 62 int sample_rate, |
62 int frames_per_buffer, | 63 int frames_per_buffer, |
63 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client); | 64 webkit::ppapi::PluginDelegate::PlatformAudioInputClient* client); |
64 | 65 |
65 // I/O thread backends to above functions. | 66 // I/O thread backends to above functions. |
66 void InitializeOnIOThread(int session_id); | 67 void InitializeOnIOThread(int session_id); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 // Initialized on the main thread and accessed on the I/O thread afterwards. | 111 // Initialized on the main thread and accessed on the I/O thread afterwards. |
111 media::AudioParameters params_; | 112 media::AudioParameters params_; |
112 | 113 |
113 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl); | 114 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInputImpl); |
114 }; | 115 }; |
115 | 116 |
116 } // namespace content | 117 } // namespace content |
117 | 118 |
118 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ | 119 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_IMPL_H_ |
OLD | NEW |