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

Unified Diff: media/audio/pulse/pulse_util.cc

Issue 2101303004: Pass delay and timestamp to AudioSourceCallback::OnMoreData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Pass target playout time to AudioSourceCallback::OnMoreData. Created 4 years, 5 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
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

Powered by Google App Engine
This is Rietveld 408576698