Chromium Code Reviews| 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 c66c8143f39aa4365121f04d52f79a65de8e352c..d5847f3784733ed84954b842629fb5abbbc1d6ba 100644 |
| --- a/media/audio/mac/audio_low_latency_input_mac.h |
| +++ b/media/audio/mac/audio_low_latency_input_mac.h |
| @@ -164,6 +164,13 @@ class MEDIA_EXPORT AUAudioInputStream |
| // filters out some that make sense to add to UMA stats. |
| void AddDevicePropertyChangesToUMA(bool startup_failed); |
| + // Updates capture timestamp, current lost frames, and total lost frames and |
| + // glitches. |
| + void UpdateCaptureTimestamp(const AudioTimeStamp* timestamp); |
| + |
| + // Called from the dtor and when the stream is reset. |
| + void ReportAndResetStats(); |
| + |
| // Verifies that Open(), Start(), Stop() and Close() are all called on the |
| // creating thread which is the main browser thread (CrBrowserMain) on Mac. |
| base::ThreadChecker thread_checker_; |
| @@ -174,6 +181,11 @@ class MEDIA_EXPORT AUAudioInputStream |
| // Contains the desired number of audio frames in each callback. |
| const size_t number_of_frames_; |
| + // Stores the number of frames that we actually get callbacks for. |
| + // This may be different from what we ask for, so we use this for stats in |
| + // order to understand how often this happens and what are the typical values. |
| + size_t number_of_frames_requested_; |
| + |
| // The actual I/O buffer size for the input device connected to the active |
| // AUHAL audio unit. |
| size_t io_buffer_frame_size_; |
| @@ -254,6 +266,20 @@ class MEDIA_EXPORT AUAudioInputStream |
| // Only touched on the creating thread. |
| bool device_listener_is_active_; |
| + // Stores the timestamp of the previous audio buffer provided by the OS. |
| + // We use this in combination with |last_number_of_frames_| to detect when |
| + // the OS has decided to skip providing frames (i.e. a glitch). |
| + // This can happen in case of high CPU load or excessive blocking on the |
| + // callback audio thread. |
| + // These variables are only touched on the callback thread and then read |
|
Henrik Grunell
2016/02/25 14:40:23
They're also read in Stop(), same as on output sid
tommi (sloooow) - chröme
2016/02/26 10:07:20
It's safe as long as the callbacks aren't active w
Henrik Grunell
2016/02/29 17:48:48
Acknowledged.
|
| + // in the dtor (when no longer receiving callbacks). |
| + // NOTE: Float64 and UInt32 types are used for native API compatibility. |
| + Float64 last_sample_time_; |
| + UInt32 last_number_of_frames_; |
| + UInt32 total_lost_frames_; |
| + UInt32 largest_glitch_frames_; |
| + int glitches_detected_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream); |
| }; |