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

Side by Side Diff: media/audio/mac/audio_low_latency_input_mac.h

Issue 2689483006: Switch browser side audio capture path to use base time primitives. (Closed)
Patch Set: Bloop Created 3 years, 10 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
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 // Implementation of AudioInputStream for Mac OS X using the special AUHAL 5 // Implementation of AudioInputStream for Mac OS X using the special AUHAL
6 // input Audio Unit present in OS 10.4 and later. 6 // input Audio Unit present in OS 10.4 and later.
7 // The AUHAL input Audio Unit is for low-latency audio I/O. 7 // The AUHAL input Audio Unit is for low-latency audio I/O.
8 // 8 //
9 // Overview of operation: 9 // Overview of operation:
10 // 10 //
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 void UpdateDataCallbackTimeOnMainThread(base::TimeTicks now_tick); 133 void UpdateDataCallbackTimeOnMainThread(base::TimeTicks now_tick);
134 134
135 // Registers OnDevicePropertyChanged() to receive notifications when device 135 // Registers OnDevicePropertyChanged() to receive notifications when device
136 // properties changes. 136 // properties changes.
137 void RegisterDeviceChangeListener(); 137 void RegisterDeviceChangeListener();
138 // Stop listening for changes in device properties. 138 // Stop listening for changes in device properties.
139 void DeRegisterDeviceChangeListener(); 139 void DeRegisterDeviceChangeListener();
140 140
141 // Gets the fixed capture hardware latency and store it during initialization. 141 // Gets the fixed capture hardware latency and store it during initialization.
142 // Returns 0 if not available. 142 // Returns 0 if not available.
143 double GetHardwareLatency(); 143 base::TimeDelta GetHardwareLatency();
144 144
145 // Gets the current capture delay value. 145 // Gets the current capture delay value.
146 double GetCaptureLatency(const AudioTimeStamp* input_time_stamp); 146 base::TimeDelta GetCaptureLatency(const AudioTimeStamp* input_time_stamp);
147 147
148 // Gets the number of channels for a stream of audio data. 148 // Gets the number of channels for a stream of audio data.
149 int GetNumberOfChannelsFromStream(); 149 int GetNumberOfChannelsFromStream();
150 150
151 // Issues the OnError() callback to the |sink_|. 151 // Issues the OnError() callback to the |sink_|.
152 void HandleError(OSStatus err); 152 void HandleError(OSStatus err);
153 153
154 // Helper function to check if the volume control is avialable on specific 154 // Helper function to check if the volume control is avialable on specific
155 // channel. 155 // channel.
156 bool IsVolumeSettableOnChannel(int channel); 156 bool IsVolumeSettableOnChannel(int channel);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // The UID refers to the current input audio device. 225 // The UID refers to the current input audio device.
226 const AudioDeviceID input_device_id_; 226 const AudioDeviceID input_device_id_;
227 227
228 // Provides a mechanism for encapsulating one or more buffers of audio data. 228 // Provides a mechanism for encapsulating one or more buffers of audio data.
229 AudioBufferList audio_buffer_list_; 229 AudioBufferList audio_buffer_list_;
230 230
231 // Temporary storage for recorded data. The InputProc() renders into this 231 // Temporary storage for recorded data. The InputProc() renders into this
232 // array as soon as a frame of the desired buffer size has been recorded. 232 // array as soon as a frame of the desired buffer size has been recorded.
233 std::unique_ptr<uint8_t[]> audio_data_buffer_; 233 std::unique_ptr<uint8_t[]> audio_data_buffer_;
234 234
235 // Fixed capture hardware latency in frames. 235 // Fixed capture hardware latency.
236 double hardware_latency_frames_; 236 base::TimeDelta hardware_latency_;
237 237
238 // The number of channels in each frame of audio data, which is used 238 // The number of channels in each frame of audio data, which is used
239 // when querying the volume of each channel. 239 // when querying the volume of each channel.
240 int number_of_channels_in_frame_; 240 int number_of_channels_in_frame_;
241 241
242 // FIFO used to accumulates recorded data. 242 // FIFO used to accumulates recorded data.
243 media::AudioBlockFifo fifo_; 243 media::AudioBlockFifo fifo_;
244 244
245 // Used to defer Start() to workaround http://crbug.com/160920. 245 // Used to defer Start() to workaround http://crbug.com/160920.
246 base::CancelableClosure deferred_start_cb_; 246 base::CancelableClosure deferred_start_cb_;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // this object is destroyed. 331 // this object is destroyed.
332 // Note that, all member variables should appear before the WeakPtrFactory. 332 // Note that, all member variables should appear before the WeakPtrFactory.
333 base::WeakPtrFactory<AUAudioInputStream> weak_factory_; 333 base::WeakPtrFactory<AUAudioInputStream> weak_factory_;
334 334
335 DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream); 335 DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream);
336 }; 336 };
337 337
338 } // namespace media 338 } // namespace media
339 339
340 #endif // MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_ 340 #endif // MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698