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

Unified Diff: media/audio/audio_output_stream_sink.cc

Issue 2101303004: Pass delay and timestamp to AudioSourceCallback::OnMoreData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix Mac CQ errors. Created 4 years, 3 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/audio_output_stream_sink.cc
diff --git a/media/audio/audio_output_stream_sink.cc b/media/audio/audio_output_stream_sink.cc
index b94e2d265847d33f2a93cab9dc3e8a90a7cbd140..5bb2f8e39d984679930a7e451da21e75a36d286e 100644
--- a/media/audio/audio_output_stream_sink.cc
+++ b/media/audio/audio_output_stream_sink.cc
@@ -4,12 +4,14 @@
#include "media/audio/audio_output_stream_sink.h"
+#include <algorithm>
#include <cmath>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/location.h"
#include "media/audio/audio_manager.h"
+#include "media/base/audio_timestamp_helper.h"
namespace media {
@@ -82,18 +84,20 @@ bool AudioOutputStreamSink::CurrentThreadIsRenderingThread() {
return false;
}
-int AudioOutputStreamSink::OnMoreData(AudioBus* dest,
- uint32_t total_bytes_delay,
- uint32_t frames_skipped) {
+int AudioOutputStreamSink::OnMoreData(base::TimeDelta delay,
+ base::TimeTicks /* delay_timestamp */,
+ int prior_frames_skipped,
+ AudioBus* dest) {
// Note: Runs on the audio thread created by the OS.
base::AutoLock al(callback_lock_);
if (!active_render_callback_)
return 0;
- uint32_t frames_delayed = std::round(static_cast<double>(total_bytes_delay) /
- active_params_.GetBytesPerFrame());
+ uint32_t frames_delayed =
+ AudioTimestampHelper::TimeToFrames(delay, active_params_.sample_rate());
- return active_render_callback_->Render(dest, frames_delayed, frames_skipped);
+ return active_render_callback_->Render(dest, frames_delayed,
+ prior_frames_skipped);
}
void AudioOutputStreamSink::OnError(AudioOutputStream* stream) {
@@ -154,4 +158,4 @@ void AudioOutputStreamSink::ClearCallback() {
active_render_callback_ = NULL;
}
-} // namepace media
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698