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

Unified Diff: ppapi/shared_impl/ppb_audio_shared.cc

Issue 2517503003: Reland: Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Comments from chcunningham@ and Dale Created 4 years 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/renderers/audio_renderer_impl_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/ppb_audio_shared.cc
diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc
index 6ae632a298ac6fda68395b8298027da5fb7e5caa..9beed72ff07a2c49cbd0367100eda589572d67f1 100644
--- a/ppapi/shared_impl/ppb_audio_shared.cc
+++ b/ppapi/shared_impl/ppb_audio_shared.cc
@@ -217,21 +217,24 @@ void PPB_Audio_Shared::CallRun(void* self) {
}
void PPB_Audio_Shared::Run() {
- int pending_data = 0;
- while (sizeof(pending_data) ==
- socket_->Receive(&pending_data, sizeof(pending_data))) {
+ int control_signal = 0;
+ while (sizeof(control_signal) ==
+ socket_->Receive(&control_signal, sizeof(control_signal))) {
// |buffer_index_| must track the number of Receive() calls. See the Send()
// call below for why this is important.
++buffer_index_;
- if (pending_data < 0)
+ if (control_signal < 0)
break;
{
TRACE_EVENT0("audio", "PPB_Audio_Shared::FireRenderCallback");
- PP_TimeDelta latency =
- static_cast<double>(pending_data) / bytes_per_second_;
- callback_.Run(
- client_buffer_.get(), client_buffer_size_bytes_, latency, user_data_);
+ media::AudioOutputBuffer* buffer =
+ reinterpret_cast<media::AudioOutputBuffer*>(shared_memory_->memory());
+ base::TimeDelta delay =
+ base::TimeDelta::FromMicroseconds(buffer->params.delay);
+
+ callback_.Run(client_buffer_.get(), client_buffer_size_bytes_,
+ delay.InSecondsF(), user_data_);
}
// Deinterleave the audio data into the shared memory as floats.
« no previous file with comments | « media/renderers/audio_renderer_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698