Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: content/renderer/media/audio_input_device.h

Issue 8491044: Link things together and enable the device selection for linux and mac. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: rebase2 Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/media/audio_messages.h ('k') | content/renderer/media/audio_input_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Low-latency audio capturing unit utilizing audio input stream provided 5 // Low-latency audio capturing unit utilizing audio input stream provided
6 // by browser process through IPC. 6 // by browser process through IPC.
7 // 7 //
8 // Relationship of classes: 8 // Relationship of classes:
9 // 9 //
10 // AudioInputController AudioInputDevice 10 // AudioInputController AudioInputDevice
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 public: 93 public:
94 virtual void Capture(const std::vector<float*>& audio_data, 94 virtual void Capture(const std::vector<float*>& audio_data,
95 size_t number_of_frames, 95 size_t number_of_frames,
96 size_t audio_delay_milliseconds) = 0; 96 size_t audio_delay_milliseconds) = 0;
97 protected: 97 protected:
98 virtual ~CaptureCallback() {} 98 virtual ~CaptureCallback() {}
99 }; 99 };
100 100
101 class CONTENT_EXPORT CaptureEventHandler { 101 class CONTENT_EXPORT CaptureEventHandler {
102 public: 102 public:
103 // Notification to the client that the device with the specific index has 103 // Notification to the client that the device with the specific |device_id|
104 // been started. This callback is triggered as a result of StartDevice(). 104 // has been started.
105 virtual void OnDeviceStarted(int device_index) = 0; 105 // This callback is triggered as a result of StartDevice().
106 virtual void OnDeviceStarted(const std::string& device_id) = 0;
106 107
107 // Notification to the client that the device has been stopped. 108 // Notification to the client that the device has been stopped.
108 virtual void OnDeviceStopped() = 0; 109 virtual void OnDeviceStopped() = 0;
109 110
110 protected: 111 protected:
111 virtual ~CaptureEventHandler() {} 112 virtual ~CaptureEventHandler() {}
112 }; 113 };
113 114
114 // Methods called on main render thread ------------------------------------- 115 // Methods called on main render thread -------------------------------------
115 AudioInputDevice(size_t buffer_size, 116 AudioInputDevice(size_t buffer_size,
(...skipping 25 matching lines...) Expand all
141 // Returns |true| on success. 142 // Returns |true| on success.
142 bool GetVolume(double* volume); 143 bool GetVolume(double* volume);
143 144
144 double sample_rate() const { return audio_parameters_.sample_rate; } 145 double sample_rate() const { return audio_parameters_.sample_rate; }
145 size_t buffer_size() const { return audio_parameters_.samples_per_packet; } 146 size_t buffer_size() const { return audio_parameters_.samples_per_packet; }
146 147
147 // Methods called on IO thread ---------------------------------------------- 148 // Methods called on IO thread ----------------------------------------------
148 // AudioInputMessageFilter::Delegate impl., called by AudioInputMessageFilter 149 // AudioInputMessageFilter::Delegate impl., called by AudioInputMessageFilter
149 virtual void OnLowLatencyCreated(base::SharedMemoryHandle handle, 150 virtual void OnLowLatencyCreated(base::SharedMemoryHandle handle,
150 base::SyncSocket::Handle socket_handle, 151 base::SyncSocket::Handle socket_handle,
151 uint32 length) OVERRIDE; 152 uint32 length);
152 virtual void OnVolume(double volume) OVERRIDE; 153 virtual void OnVolume(double volume);
153 virtual void OnStateChanged(AudioStreamState state) OVERRIDE; 154 virtual void OnStateChanged(AudioStreamState state);
154 virtual void OnDeviceReady(int index) OVERRIDE; 155 virtual void OnDeviceReady(const std::string& device_id);
155 156
156 private: 157 private:
157 // Methods called on IO thread ---------------------------------------------- 158 // Methods called on IO thread ----------------------------------------------
158 // The following methods are tasks posted on the IO thread that needs to 159 // The following methods are tasks posted on the IO thread that needs to
159 // be executed on that thread. They interact with AudioInputMessageFilter and 160 // be executed on that thread. They interact with AudioInputMessageFilter and
160 // sends IPC messages on that thread. 161 // sends IPC messages on that thread.
161 void InitializeOnIOThread(); 162 void InitializeOnIOThread();
162 void SetSessionIdOnIOThread(int session_id); 163 void SetSessionIdOnIOThread(int session_id);
163 void StartOnIOThread(); 164 void StartOnIOThread();
164 void ShutDownOnIOThread(base::WaitableEvent* completion); 165 void ShutDownOnIOThread(base::WaitableEvent* completion);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // callback. Only modified on the IO thread. 213 // callback. Only modified on the IO thread.
213 bool pending_device_ready_; 214 bool pending_device_ready_;
214 215
215 scoped_ptr<base::SharedMemory> shared_memory_; 216 scoped_ptr<base::SharedMemory> shared_memory_;
216 scoped_ptr<base::SyncSocket> socket_; 217 scoped_ptr<base::SyncSocket> socket_;
217 218
218 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice); 219 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputDevice);
219 }; 220 };
220 221
221 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_ 222 #endif // CONTENT_RENDERER_MEDIA_AUDIO_INPUT_DEVICE_H_
OLDNEW
« no previous file with comments | « content/common/media/audio_messages.h ('k') | content/renderer/media/audio_input_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698