OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_input.h" | 5 #include "media/audio/pulse/pulse_input.h" |
6 | 6 |
7 #include <pulse/pulseaudio.h> | 7 #include <pulse/pulseaudio.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "media/audio/pulse/audio_manager_pulse.h" | 10 #include "media/audio/pulse/audio_manager_pulse.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 int packet_size = params_.GetBytesPerBuffer(); | 272 int packet_size = params_.GetBytesPerBuffer(); |
273 while (buffer_->forward_bytes() >= packet_size) { | 273 while (buffer_->forward_bytes() >= packet_size) { |
274 buffer_->Read(audio_data_buffer_.get(), packet_size); | 274 buffer_->Read(audio_data_buffer_.get(), packet_size); |
275 callback_->OnData(this, audio_data_buffer_.get(), packet_size, | 275 callback_->OnData(this, audio_data_buffer_.get(), packet_size, |
276 hardware_delay, normalized_volume); | 276 hardware_delay, normalized_volume); |
277 | 277 |
278 if (buffer_->forward_bytes() < packet_size) | 278 if (buffer_->forward_bytes() < packet_size) |
279 break; | 279 break; |
280 | 280 |
281 // TODO(xians): improve the code by implementing a WaitTillDataReady on the | 281 // TODO(xians): Remove once PPAPI is using circular buffers. |
282 // input side. | |
283 DVLOG(1) << "OnData is being called consecutively, sleep 5ms to " | 282 DVLOG(1) << "OnData is being called consecutively, sleep 5ms to " |
284 << "wait until render consumes the data"; | 283 << "wait until render consumes the data"; |
285 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(5)); | 284 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(5)); |
286 } | 285 } |
287 | 286 |
288 pa_threaded_mainloop_signal(pa_mainloop_, 0); | 287 pa_threaded_mainloop_signal(pa_mainloop_, 0); |
289 } | 288 } |
290 | 289 |
291 } // namespace media | 290 } // namespace media |
OLD | NEW |