OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // zero in most calls and then have no effect of the stats. It is only updated | 402 // zero in most calls and then have no effect of the stats. It is only updated |
403 // approximately two times per second and can then change the stats. | 403 // approximately two times per second and can then change the stats. |
404 task_queue_.PostTask([this, max_abs, num_samples_out] { | 404 task_queue_.PostTask([this, max_abs, num_samples_out] { |
405 UpdatePlayStats(max_abs, num_samples_out); | 405 UpdatePlayStats(max_abs, num_samples_out); |
406 }); | 406 }); |
407 return static_cast<int32_t>(num_samples_out); | 407 return static_cast<int32_t>(num_samples_out); |
408 } | 408 } |
409 | 409 |
410 int32_t AudioDeviceBuffer::GetPlayoutData(void* audio_buffer) { | 410 int32_t AudioDeviceBuffer::GetPlayoutData(void* audio_buffer) { |
411 RTC_DCHECK_RUN_ON(&playout_thread_checker_); | 411 RTC_DCHECK_RUN_ON(&playout_thread_checker_); |
412 RTC_DCHECK_GT(play_buffer_.size(), 0u); | 412 RTC_DCHECK_GT(play_buffer_.size(), 0); |
413 const size_t bytes_per_sample = sizeof(int16_t); | 413 const size_t bytes_per_sample = sizeof(int16_t); |
414 memcpy(audio_buffer, play_buffer_.data(), | 414 memcpy(audio_buffer, play_buffer_.data(), |
415 play_buffer_.size() * bytes_per_sample); | 415 play_buffer_.size() * bytes_per_sample); |
416 // Return samples per channel or number of frames. | 416 // Return samples per channel or number of frames. |
417 return static_cast<int32_t>(play_buffer_.size() / play_channels_); | 417 return static_cast<int32_t>(play_buffer_.size() / play_channels_); |
418 } | 418 } |
419 | 419 |
420 void AudioDeviceBuffer::StartPeriodicLogging() { | 420 void AudioDeviceBuffer::StartPeriodicLogging() { |
421 task_queue_.PostTask(rtc::Bind(&AudioDeviceBuffer::LogStats, this, | 421 task_queue_.PostTask(rtc::Bind(&AudioDeviceBuffer::LogStats, this, |
422 AudioDeviceBuffer::LOG_START)); | 422 AudioDeviceBuffer::LOG_START)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 size_t samples_per_channel) { | 525 size_t samples_per_channel) { |
526 RTC_DCHECK_RUN_ON(&task_queue_); | 526 RTC_DCHECK_RUN_ON(&task_queue_); |
527 ++play_callbacks_; | 527 ++play_callbacks_; |
528 play_samples_ += samples_per_channel; | 528 play_samples_ += samples_per_channel; |
529 if (max_abs > max_play_level_) { | 529 if (max_abs > max_play_level_) { |
530 max_play_level_ = max_abs; | 530 max_play_level_ = max_abs; |
531 } | 531 } |
532 } | 532 } |
533 | 533 |
534 } // namespace webrtc | 534 } // namespace webrtc |
OLD | NEW |