| 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 "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 stream->volume_ = static_cast<double>(volume); | 283 stream->volume_ = static_cast<double>(volume); |
| 284 } | 284 } |
| 285 | 285 |
| 286 // static, used by pa_stream_set_state_callback. | 286 // static, used by pa_stream_set_state_callback. |
| 287 void PulseAudioInputStream::StreamNotifyCallback(pa_stream* s, | 287 void PulseAudioInputStream::StreamNotifyCallback(pa_stream* s, |
| 288 void* user_data) { | 288 void* user_data) { |
| 289 PulseAudioInputStream* stream = | 289 PulseAudioInputStream* stream = |
| 290 reinterpret_cast<PulseAudioInputStream*>(user_data); | 290 reinterpret_cast<PulseAudioInputStream*>(user_data); |
| 291 if (s && stream->callback_ && | 291 if (s && stream->callback_ && |
| 292 pa_stream_get_state(s) == PA_STREAM_FAILED) { | 292 pa_stream_get_state(s) == PA_STREAM_FAILED) { |
| 293 stream->callback_->OnError(stream, pa_context_errno(stream->pa_context_)); | 293 stream->callback_->OnError(stream); |
| 294 } | 294 } |
| 295 | 295 |
| 296 pa_threaded_mainloop_signal(stream->pa_mainloop_, 0); | 296 pa_threaded_mainloop_signal(stream->pa_mainloop_, 0); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void PulseAudioInputStream::ReadData() { | 299 void PulseAudioInputStream::ReadData() { |
| 300 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( | 300 uint32 hardware_delay = pulse::GetHardwareLatencyInBytes( |
| 301 handle_, params_.sample_rate(), params_.GetBytesPerFrame()); | 301 handle_, params_.sample_rate(), params_.GetBytesPerFrame()); |
| 302 | 302 |
| 303 // Update the AGC volume level once every second. Note that, | 303 // Update the AGC volume level once every second. Note that, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 DVLOG(1) << "OnData is being called consecutively, sleep 5ms to " | 337 DVLOG(1) << "OnData is being called consecutively, sleep 5ms to " |
| 338 << "wait until render consumes the data"; | 338 << "wait until render consumes the data"; |
| 339 base::PlatformThread::Sleep( | 339 base::PlatformThread::Sleep( |
| 340 base::TimeDelta::FromMilliseconds(5)); | 340 base::TimeDelta::FromMilliseconds(5)); |
| 341 } | 341 } |
| 342 | 342 |
| 343 pa_threaded_mainloop_signal(pa_mainloop_, 0); | 343 pa_threaded_mainloop_signal(pa_mainloop_, 0); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace media | 346 } // namespace media |
| OLD | NEW |