| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/audio/pulse/pulse_unified.h" | 5 #include "media/audio/pulse/pulse_unified.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "media/audio/audio_manager_base.h" | 9 #include "media/audio/audio_manager_base.h" |
| 10 #include "media/audio/audio_parameters.h" | 10 #include "media/audio/audio_parameters.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 CHECK_EQ(requested_bytes, static_cast<size_t>(params_.GetBytesPerBuffer())); | 150 CHECK_EQ(requested_bytes, static_cast<size_t>(params_.GetBytesPerBuffer())); |
| 151 | 151 |
| 152 void* buffer = NULL; | 152 void* buffer = NULL; |
| 153 int frames_filled = 0; | 153 int frames_filled = 0; |
| 154 if (source_callback_) { | 154 if (source_callback_) { |
| 155 CHECK_GE(pa_stream_begin_write( | 155 CHECK_GE(pa_stream_begin_write( |
| 156 output_stream_, &buffer, &requested_bytes), 0); | 156 output_stream_, &buffer, &requested_bytes), 0); |
| 157 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( | 157 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( |
| 158 output_stream_, params_.sample_rate(), | 158 output_stream_, params_.sample_rate(), |
| 159 params_.GetBytesPerFrame()); | 159 params_.GetBytesPerFrame()); |
| 160 source_callback_->WaitTillDataReady(); | |
| 161 fifo_->Read(input_data_buffer_.get(), requested_bytes); | 160 fifo_->Read(input_data_buffer_.get(), requested_bytes); |
| 162 input_bus_->FromInterleaved( | 161 input_bus_->FromInterleaved( |
| 163 input_data_buffer_.get(), params_.frames_per_buffer(), 2); | 162 input_data_buffer_.get(), params_.frames_per_buffer(), 2); |
| 164 | 163 |
| 165 frames_filled = source_callback_->OnMoreIOData( | 164 frames_filled = source_callback_->OnMoreIOData( |
| 166 input_bus_.get(), | 165 input_bus_.get(), |
| 167 output_bus_.get(), | 166 output_bus_.get(), |
| 168 AudioBuffersState(0, hardware_delay)); | 167 AudioBuffersState(0, hardware_delay)); |
| 169 } | 168 } |
| 170 | 169 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 volume_ = static_cast<float>(volume); | 283 volume_ = static_cast<float>(volume); |
| 285 } | 284 } |
| 286 | 285 |
| 287 void PulseAudioUnifiedStream::GetVolume(double* volume) { | 286 void PulseAudioUnifiedStream::GetVolume(double* volume) { |
| 288 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | 287 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); |
| 289 | 288 |
| 290 *volume = volume_; | 289 *volume = volume_; |
| 291 } | 290 } |
| 292 | 291 |
| 293 } // namespace media | 292 } // namespace media |
| OLD | NEW |