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_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_H_ |
6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void StopCapture(); | 57 void StopCapture(); |
58 // Closes the stream. Make sure to call this before the object is destructed. | 58 // Closes the stream. Make sure to call this before the object is destructed. |
59 void ShutDown(); | 59 void ShutDown(); |
60 | 60 |
61 // media::AudioInputIPCDelegate. | 61 // media::AudioInputIPCDelegate. |
62 virtual void OnStreamCreated(base::SharedMemoryHandle handle, | 62 virtual void OnStreamCreated(base::SharedMemoryHandle handle, |
63 base::SyncSocket::Handle socket_handle, | 63 base::SyncSocket::Handle socket_handle, |
64 int length, | 64 int length, |
65 int total_segments) OVERRIDE; | 65 int total_segments) OVERRIDE; |
66 virtual void OnVolume(double volume) OVERRIDE; | 66 virtual void OnVolume(double volume) OVERRIDE; |
67 virtual void OnStateChanged( | 67 virtual void OnStateChanged(media::AudioInputIPCDelegate::State state) |
68 media::AudioInputIPCDelegate::State state) OVERRIDE; | 68 OVERRIDE; |
69 virtual void OnIPCClosed() OVERRIDE; | 69 virtual void OnIPCClosed() OVERRIDE; |
70 | 70 |
71 protected: | 71 protected: |
72 virtual ~PepperPlatformAudioInput(); | 72 virtual ~PepperPlatformAudioInput(); |
73 | 73 |
74 private: | 74 private: |
75 friend class base::RefCountedThreadSafe<PepperPlatformAudioInput>; | 75 friend class base::RefCountedThreadSafe<PepperPlatformAudioInput>; |
76 | 76 |
77 PepperPlatformAudioInput(); | 77 PepperPlatformAudioInput(); |
78 | 78 |
79 bool Initialize( | 79 bool Initialize(const base::WeakPtr<RenderViewImpl>& render_view, |
80 const base::WeakPtr<RenderViewImpl>& render_view, | 80 const std::string& device_id, |
81 const std::string& device_id, | 81 const GURL& document_url, |
82 const GURL& document_url, | 82 int sample_rate, |
83 int sample_rate, | 83 int frames_per_buffer, |
84 int frames_per_buffer, | 84 PepperAudioInputHost* client); |
85 PepperAudioInputHost* client); | |
86 | 85 |
87 // I/O thread backends to above functions. | 86 // I/O thread backends to above functions. |
88 void InitializeOnIOThread(int session_id); | 87 void InitializeOnIOThread(int session_id); |
89 void StartCaptureOnIOThread(); | 88 void StartCaptureOnIOThread(); |
90 void StopCaptureOnIOThread(); | 89 void StopCaptureOnIOThread(); |
91 void ShutDownOnIOThread(); | 90 void ShutDownOnIOThread(); |
92 | 91 |
93 void OnDeviceOpened(int request_id, | 92 void OnDeviceOpened(int request_id, bool succeeded, const std::string& label); |
94 bool succeeded, | |
95 const std::string& label); | |
96 void CloseDevice(); | 93 void CloseDevice(); |
97 void NotifyStreamCreationFailed(); | 94 void NotifyStreamCreationFailed(); |
98 | 95 |
99 PepperMediaDeviceManager* GetMediaDeviceManager(); | 96 PepperMediaDeviceManager* GetMediaDeviceManager(); |
100 | 97 |
101 // The client to notify when the stream is created. THIS MUST ONLY BE | 98 // The client to notify when the stream is created. THIS MUST ONLY BE |
102 // ACCESSED ON THE MAIN THREAD. | 99 // ACCESSED ON THE MAIN THREAD. |
103 PepperAudioInputHost* client_; | 100 PepperAudioInputHost* client_; |
104 | 101 |
105 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE | 102 // Used to send/receive IPC. THIS MUST ONLY BE ACCESSED ON THE |
(...skipping 23 matching lines...) Expand all Loading... |
129 bool pending_open_device_; | 126 bool pending_open_device_; |
130 // THIS MUST ONLY BE ACCESSED ON THE MAIN THREAD. | 127 // THIS MUST ONLY BE ACCESSED ON THE MAIN THREAD. |
131 int pending_open_device_id_; | 128 int pending_open_device_id_; |
132 | 129 |
133 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInput); | 130 DISALLOW_COPY_AND_ASSIGN(PepperPlatformAudioInput); |
134 }; | 131 }; |
135 | 132 |
136 } // namespace content | 133 } // namespace content |
137 | 134 |
138 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_H_ | 135 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLATFORM_AUDIO_INPUT_H_ |
OLD | NEW |