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

Side by Side Diff: media/audio/audio_input_controller.h

Issue 11416350: Tab Audio Mirroring: WebContentsAudioInputStream is a new implementation which represents the lifet… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 11 months 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/content_tests.gypi ('k') | media/audio/audio_input_controller.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) 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 MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // done, the event handler will receive an OnCreated() call from that same 139 // done, the event handler will receive an OnCreated() call from that same
140 // thread. 140 // thread.
141 static scoped_refptr<AudioInputController> CreateLowLatency( 141 static scoped_refptr<AudioInputController> CreateLowLatency(
142 AudioManager* audio_manager, 142 AudioManager* audio_manager,
143 EventHandler* event_handler, 143 EventHandler* event_handler,
144 const AudioParameters& params, 144 const AudioParameters& params,
145 const std::string& device_id, 145 const std::string& device_id,
146 // External synchronous writer for audio controller. 146 // External synchronous writer for audio controller.
147 SyncWriter* sync_writer); 147 SyncWriter* sync_writer);
148 148
149 // Factory method for creating an AudioInputController for low-latency mode,
150 // taking ownership of |stream|. The stream will be opened on the audio
151 // thread, and when that is done, the event handler will receive an
152 // OnCreated() call from that same thread.
153 static scoped_refptr<AudioInputController> CreateForStream(
154 AudioManager* audio_manager,
155 EventHandler* event_handler,
156 AudioInputStream* stream,
157 // External synchronous writer for audio controller.
158 SyncWriter* sync_writer);
159
149 // Starts recording using the created audio input stream. 160 // Starts recording using the created audio input stream.
150 // This method is called on the creator thread. 161 // This method is called on the creator thread.
151 virtual void Record(); 162 virtual void Record();
152 163
153 // Closes the audio input stream. The state is changed and the resources 164 // Closes the audio input stream. The state is changed and the resources
154 // are freed on the audio thread. |closed_task| is then executed on the thread 165 // are freed on the audio thread. |closed_task| is then executed on the thread
155 // that called Close(). 166 // that called Close().
156 // Callbacks (EventHandler and SyncWriter) must exist until |closed_task| 167 // Callbacks (EventHandler and SyncWriter) must exist until |closed_task|
157 // is called. 168 // is called.
158 // It is safe to call this method more than once. Calls after the first one 169 // It is safe to call this method more than once. Calls after the first one
(...skipping 29 matching lines...) Expand all
188 kClosed, 199 kClosed,
189 kError 200 kError
190 }; 201 };
191 202
192 AudioInputController(EventHandler* handler, SyncWriter* sync_writer); 203 AudioInputController(EventHandler* handler, SyncWriter* sync_writer);
193 virtual ~AudioInputController(); 204 virtual ~AudioInputController();
194 205
195 // Methods called on the audio thread (owned by the AudioManager). 206 // Methods called on the audio thread (owned by the AudioManager).
196 void DoCreate(AudioManager* audio_manager, const AudioParameters& params, 207 void DoCreate(AudioManager* audio_manager, const AudioParameters& params,
197 const std::string& device_id); 208 const std::string& device_id);
209 void DoCreateForStream(AudioInputStream* stream_to_control);
198 void DoRecord(); 210 void DoRecord();
199 void DoClose(); 211 void DoClose();
200 void DoReportError(int code); 212 void DoReportError(int code);
201 void DoSetVolume(double volume); 213 void DoSetVolume(double volume);
202 void DoSetAutomaticGainControl(bool enabled); 214 void DoSetAutomaticGainControl(bool enabled);
203 215
204 // Method which ensures that OnError() is triggered when data recording 216 // Method which ensures that OnError() is triggered when data recording
205 // times out. Called on the audio thread. 217 // times out. Called on the audio thread.
206 void DoCheckForNoData(); 218 void DoCheckForNoData();
207 219
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 static Factory* factory_; 263 static Factory* factory_;
252 264
253 double max_volume_; 265 double max_volume_;
254 266
255 DISALLOW_COPY_AND_ASSIGN(AudioInputController); 267 DISALLOW_COPY_AND_ASSIGN(AudioInputController);
256 }; 268 };
257 269
258 } // namespace media 270 } // namespace media
259 271
260 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ 272 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | media/audio/audio_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698