| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 CHECK_EQ(requested_bytes, static_cast<size_t>(params_.GetBytesPerBuffer())); | 148 CHECK_EQ(requested_bytes, static_cast<size_t>(params_.GetBytesPerBuffer())); |
| 149 | 149 |
| 150 void* buffer = NULL; | 150 void* buffer = NULL; |
| 151 int frames_filled = 0; | 151 int frames_filled = 0; |
| 152 if (source_callback_) { | 152 if (source_callback_) { |
| 153 CHECK_GE(pa_stream_begin_write( | 153 CHECK_GE(pa_stream_begin_write( |
| 154 output_stream_, &buffer, &requested_bytes), 0); | 154 output_stream_, &buffer, &requested_bytes), 0); |
| 155 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( | 155 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( |
| 156 output_stream_, params_.sample_rate(), | 156 output_stream_, params_.sample_rate(), |
| 157 params_.GetBytesPerFrame()); | 157 params_.GetBytesPerFrame()); |
| 158 source_callback_->WaitTillDataReady(); | |
| 159 fifo_->Read(input_data_buffer_.get(), requested_bytes); | 158 fifo_->Read(input_data_buffer_.get(), requested_bytes); |
| 160 input_bus_->FromInterleaved( | 159 input_bus_->FromInterleaved( |
| 161 input_data_buffer_.get(), params_.frames_per_buffer(), 2); | 160 input_data_buffer_.get(), params_.frames_per_buffer(), 2); |
| 162 | 161 |
| 163 frames_filled = source_callback_->OnMoreIOData( | 162 frames_filled = source_callback_->OnMoreIOData( |
| 164 input_bus_.get(), | 163 input_bus_.get(), |
| 165 output_bus_.get(), | 164 output_bus_.get(), |
| 166 AudioBuffersState(0, hardware_delay)); | 165 AudioBuffersState(0, hardware_delay)); |
| 167 } | 166 } |
| 168 | 167 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 volume_ = static_cast<float>(volume); | 281 volume_ = static_cast<float>(volume); |
| 283 } | 282 } |
| 284 | 283 |
| 285 void PulseAudioUnifiedStream::GetVolume(double* volume) { | 284 void PulseAudioUnifiedStream::GetVolume(double* volume) { |
| 286 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | 285 DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); |
| 287 | 286 |
| 288 *volume = volume_; | 287 *volume = volume_; |
| 289 } | 288 } |
| 290 | 289 |
| 291 } // namespace media | 290 } // namespace media |
| OLD | NEW |