Index: media/audio/pulse/pulse_util.cc |
diff --git a/media/audio/pulse/pulse_util.cc b/media/audio/pulse/pulse_util.cc |
index d5c699a09e28a821fd1e7107ca1cd6be9858d24a..b98fadbc49eddd6aa6c05c7ed9ed43a9ad4a2b45 100644 |
--- a/media/audio/pulse/pulse_util.cc |
+++ b/media/audio/pulse/pulse_util.cc |
@@ -1,3 +1,4 @@ |
+ |
chcunningham
2016/07/29 01:21:09
space
jameswest
2016/08/26 02:08:47
Done.
|
// Copyright (c) 2012 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. |
@@ -8,7 +9,6 @@ |
#include "base/logging.h" |
#include "base/macros.h" |
-#include "base/time/time.h" |
#include "media/audio/audio_device_description.h" |
#include "media/base/audio_parameters.h" |
@@ -136,20 +136,24 @@ void WaitForOperationCompletion(pa_threaded_mainloop* pa_mainloop, |
pa_operation_unref(operation); |
} |
-int GetHardwareLatencyInBytes(pa_stream* stream, |
- int sample_rate, |
- int bytes_per_frame) { |
+base::TimeDelta GetHardwareLatency(pa_stream* stream) { |
DCHECK(stream); |
int negative = 0; |
pa_usec_t latency_micros = 0; |
if (pa_stream_get_latency(stream, &latency_micros, &negative) != 0) |
- return 0; |
+ return base::TimeDelta(); |
if (negative) |
- return 0; |
+ return base::TimeDelta(); |
+ |
+ return base::TimeDelta::FromMicroseconds(latency_micros); |
+} |
- return latency_micros * sample_rate * bytes_per_frame / |
- base::Time::kMicrosecondsPerSecond; |
+int GetHardwareLatencyInBytes(pa_stream* stream, |
+ int sample_rate, |
+ int bytes_per_frame) { |
+ DCHECK(stream); |
+ return GetHardwareLatency(stream).InSeconds() * sample_rate * bytes_per_frame; |
} |
// Helper macro for CreateInput/OutputStream() to avoid code spam and |