OLD | NEW |
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 #include "media/audio/mac/audio_low_latency_output_mac.h" | 5 #include "media/audio/mac/audio_low_latency_output_mac.h" |
6 | 6 |
| 7 #include <CoreAudio/HostTime.h> |
7 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
8 | 9 |
9 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/mac/mac_logging.h" | 12 #include "base/mac/mac_logging.h" |
12 #include "media/audio/audio_util.h" | 13 #include "media/audio/audio_util.h" |
13 #include "media/audio/mac/audio_manager_mac.h" | 14 #include "media/audio/mac/audio_manager_mac.h" |
14 | 15 |
15 namespace media { | 16 namespace media { |
16 | 17 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 UInt64 output_time_ns = AudioConvertHostTimeToNanos( | 348 UInt64 output_time_ns = AudioConvertHostTimeToNanos( |
348 output_time_stamp->mHostTime); | 349 output_time_stamp->mHostTime); |
349 UInt64 now_ns = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime()); | 350 UInt64 now_ns = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime()); |
350 double delay_frames = static_cast<double> | 351 double delay_frames = static_cast<double> |
351 (1e-9 * (output_time_ns - now_ns) * format_.mSampleRate); | 352 (1e-9 * (output_time_ns - now_ns) * format_.mSampleRate); |
352 | 353 |
353 return (delay_frames + hardware_latency_frames_); | 354 return (delay_frames + hardware_latency_frames_); |
354 } | 355 } |
355 | 356 |
356 } // namespace media | 357 } // namespace media |
OLD | NEW |