Chromium Code Reviews| 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_); |
| } |