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

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: replace deprecated AudioDevice* with AudioObject* & round the latency before converting to bytes 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
« no previous file with comments | « no previous file | media/audio/mac/audio_low_latency_input_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/mac/audio_low_latency_input_mac.h
diff --git a/media/audio/mac/audio_low_latency_input_mac.h b/media/audio/mac/audio_low_latency_input_mac.h
index 8d1811c80dfd51296a0ab89a3a9b0fb9dd9f1e92..f3b28911c911e5f573e65dd5d8e8251d958e0ee4 100644
--- a/media/audio/mac/audio_low_latency_input_mac.h
+++ b/media/audio/mac/audio_low_latency_input_mac.h
@@ -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 the actual recording instant and the time when the
+// data packet is provided as a callback.
//
#ifndef MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_
#define MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_
@@ -73,7 +78,15 @@ class AUAudioInputStream : public AudioInputStream {
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);
+
+ // Gets the fixed capture hardware latency and store it during initialization.
+ // Returns 0 if not available.
+ double GetHardwareLatency();
+
+ // Gets the current capture delay value.
+ double GetCaptureLatency(const AudioTimeStamp* input_time_stamp);
// Issues the OnError() callback to the |sink_|.
void HandleError(OSStatus err);
@@ -96,6 +109,9 @@ class AUAudioInputStream : public AudioInputStream {
// 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 +122,9 @@ class AUAudioInputStream : public AudioInputStream {
// True after successfull Start(), false after successful Stop().
bool started_;
+ // Fixed capture hardware latency in frames.
+ double hardware_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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698