| Index: media/audio/mac/audio_low_latency_output_mac.h
|
| ===================================================================
|
| --- media/audio/mac/audio_low_latency_output_mac.h (revision 104447)
|
| +++ media/audio/mac/audio_low_latency_output_mac.h (working copy)
|
| @@ -1,12 +1,24 @@
|
| // Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| -
|
| +//
|
| +// Implementation notes:
|
| +//
|
| +// - It is recommended to first acquire the native sample rate of the default
|
| +// output device and then use the same rate when creating this object.
|
| +// Use AUAudioOutputStream::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 hit the hardware.
|
| +//
|
| #ifndef MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_
|
| #define MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_OUTPUT_MAC_H_
|
|
|
| #include <AudioUnit/AudioUnit.h>
|
|
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "media/audio/audio_io.h"
|
| #include "media/audio/audio_parameters.h"
|
|
|
| @@ -44,11 +56,18 @@
|
| UInt32 number_of_frames,
|
| AudioBufferList* io_data);
|
|
|
| - OSStatus Render(UInt32 number_of_frames, AudioBufferList* io_data);
|
| + OSStatus Render(UInt32 number_of_frames, AudioBufferList* io_data,
|
| + const AudioTimeStamp* output_time_stamp);
|
|
|
| // Sets up the stream format for the default output Audio Unit.
|
| bool Configure();
|
|
|
| + // Gets playout device hardware latency.
|
| + void UpdateHardwareLatency();
|
| +
|
| + // Updates estimated playout latency value.
|
| + void UpdatePlayoutLatency(const AudioTimeStamp* output_time_stamp);
|
| +
|
| // Our creator, the audio manager needs to be notified when we close.
|
| AudioManagerMac* manager_;
|
|
|
| @@ -63,9 +82,19 @@
|
| // The default output Audio Unit which talks to the audio hardware.
|
| AudioUnit output_unit_;
|
|
|
| + // The UID refers to the output audio device.
|
| + AudioDeviceID output_device_id_;
|
| +
|
| // Volume level from 0 to 1.
|
| float volume_;
|
|
|
| + // Playout hardware latency in millisecond, the value is updated when
|
| + // initiating the output Audio Unit.
|
| + uint32 hardware_latency_ms_;
|
| +
|
| + // Playout estimated latency in millisecond.
|
| + uint32 playout_latency_ms_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(AUAudioOutputStream);
|
| };
|
|
|
|
|