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

Unified Diff: media/audio/audio_output_stream_sink.cc

Issue 1687213002: Express audio delay more precisely in frames rather than milliseconds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/audio_parameters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92739b31e3a771f5978201e887fb01b9ca32eaef..460dedecf05c902729a0f278ec7cd7de27816e76 100644
--- a/media/audio/audio_output_stream_sink.cc
+++ b/media/audio/audio_output_stream_sink.cc
@@ -4,6 +4,8 @@
#include "media/audio/audio_output_stream_sink.h"
+#include <cmath>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/location.h"
@@ -83,8 +85,10 @@ int AudioOutputStreamSink::OnMoreData(AudioBus* dest,
if (!active_render_callback_)
return 0;
- return active_render_callback_->Render(
- dest, total_bytes_delay * 1000.0 / active_params_.GetBytesPerSecond(), 0);
+ uint32_t frames_delayed = std::round(static_cast<double>(total_bytes_delay) /
+ active_params_.GetBytesPerFrame());
+
+ return active_render_callback_->Render(dest, frames_delayed, frames_skipped);
}
void AudioOutputStreamSink::OnError(AudioOutputStream* stream) {
« no previous file with comments | « media/audio/audio_output_device.cc ('k') | media/audio/audio_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698