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

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: Pepper audio fixed Created 4 years, 1 month 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: 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..db92d0b2d839599d821ef6695edb61af46b8ff5d 100644
--- a/ppapi/shared_impl/ppb_audio_shared.cc
+++ b/ppapi/shared_impl/ppb_audio_shared.cc
@@ -217,19 +217,25 @@ 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_;
+ media::AudioOutputBuffer* buffer =
+ reinterpret_cast<media::AudioOutputBuffer*>(shared_memory_->memory());
+ base::TimeDelta delay =
+ base::TimeDelta::FromMicroseconds(buffer->params.delay);
+ buffer->params.delay = 0;
DaleCurtis 2016/11/28 22:55:46 Again why?
Mikhail 2016/11/29 14:54:49 Done.
+
+ PP_TimeDelta latency = delay.InSecondsF();
DaleCurtis 2016/11/28 22:55:46 Just inline into callback.
Mikhail 2016/11/29 14:54:49 Done.
+
callback_.Run(
client_buffer_.get(), client_buffer_size_bytes_, latency, user_data_);
}
« media/audio/audio_output_device.cc ('K') | « 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