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

Unified Diff: media/audio/mac/audio_low_latency_input_mac.h

Issue 8234009: Adding input and output delay estimation for mac. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: increase the delay precision Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/mac/audio_low_latency_input_mac.h
===================================================================
--- media/audio/mac/audio_low_latency_input_mac.h (revision 104447)
+++ media/audio/mac/audio_low_latency_input_mac.h (working copy)
@@ -27,6 +27,11 @@
// input device and then use the same rate when creating this object.
// Use AUAudioInputStream::HardwareSampleRate() to retrieve the sample rate.
// - Calling Close() also leads to self destruction.
+// - The latency consists of two parts:
+// 1, Hardware latency, which includes Audio Unit latency, audio device
+// latency and audio stream latency;
+// 2, The delay between now and the scheduled time stamp that tells when the
+// data we are providing is going to reach the hardware.
//
#ifndef MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_
#define MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_
@@ -73,8 +78,15 @@
AudioBufferList* io_data);
// Pushes recorded data to consumer of the input audio stream.
- OSStatus Provide(UInt32 number_of_frames, AudioBufferList* io_data);
+ OSStatus Provide(UInt32 number_of_frames, AudioBufferList* io_data,
+ const AudioTimeStamp* time_stamp);
+ // Get the fixed capture hardware latency and store it during initialization.
+ void StoreHardwareLatency();
+
+ // Updates the current capture delay value.
+ void UpdateCaptureLatency(const AudioTimeStamp* input_time_stamp);
+
// Issues the OnError() callback to the |sink_|.
void HandleError(OSStatus err);
@@ -96,6 +108,9 @@
// The AUHAL also enables selection of non default devices.
AudioUnit audio_unit_;
+ // The UID refers to the current input audio device.
+ AudioDeviceID input_device_id_;
+
// Provides a mechanism for encapsulating one or more buffers of audio data.
AudioBufferList audio_buffer_list_;
@@ -106,6 +121,12 @@
// True after successfull Start(), false after successful Stop().
bool started_;
+ // Fixed capture hardware latency in frames.
+ double hardware_latency_frames_;
scherkus (not reviewing) 2011/10/19 16:35:15 frames are typically integers -- any reason why we
+
+ // Current capture latency in frames.
+ double capture_latency_frames_;
+
DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream);
};
« no previous file with comments | « no previous file | media/audio/mac/audio_low_latency_input_mac.cc » ('j') | media/audio/mac/audio_low_latency_input_mac.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698