| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 size_t position) { | 69 size_t position) { |
| 70 ReplaceAtIndex(insert_this, insert_this.Size(), position); | 70 ReplaceAtIndex(insert_this, insert_this.Size(), position); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SyncBuffer::GetNextAudioInterleaved(size_t requested_len, | 73 void SyncBuffer::GetNextAudioInterleaved(size_t requested_len, |
| 74 AudioFrame* output) { | 74 AudioFrame* output) { |
| 75 RTC_DCHECK(output); | 75 RTC_DCHECK(output); |
| 76 const size_t samples_to_read = std::min(FutureLength(), requested_len); | 76 const size_t samples_to_read = std::min(FutureLength(), requested_len); |
| 77 output->Reset(); | 77 output->Reset(); |
| 78 const size_t tot_samples_read = | 78 const size_t tot_samples_read = |
| 79 ReadInterleavedFromIndex(next_index_, samples_to_read, output->data_); | 79 ReadInterleavedFromIndex(next_index_, samples_to_read, |
| 80 output->mutable_data()); |
| 80 const size_t samples_read_per_channel = tot_samples_read / Channels(); | 81 const size_t samples_read_per_channel = tot_samples_read / Channels(); |
| 81 next_index_ += samples_read_per_channel; | 82 next_index_ += samples_read_per_channel; |
| 82 output->num_channels_ = Channels(); | 83 output->num_channels_ = Channels(); |
| 83 output->samples_per_channel_ = samples_read_per_channel; | 84 output->samples_per_channel_ = samples_read_per_channel; |
| 84 } | 85 } |
| 85 | 86 |
| 86 void SyncBuffer::IncreaseEndTimestamp(uint32_t increment) { | 87 void SyncBuffer::IncreaseEndTimestamp(uint32_t increment) { |
| 87 end_timestamp_ += increment; | 88 end_timestamp_ += increment; |
| 88 } | 89 } |
| 89 | 90 |
| 90 void SyncBuffer::Flush() { | 91 void SyncBuffer::Flush() { |
| 91 Zeros(Size()); | 92 Zeros(Size()); |
| 92 next_index_ = Size(); | 93 next_index_ = Size(); |
| 93 end_timestamp_ = 0; | 94 end_timestamp_ = 0; |
| 94 dtmf_index_ = 0; | 95 dtmf_index_ = 0; |
| 95 } | 96 } |
| 96 | 97 |
| 97 void SyncBuffer::set_next_index(size_t value) { | 98 void SyncBuffer::set_next_index(size_t value) { |
| 98 // Cannot set |next_index_| larger than the size of the buffer. | 99 // Cannot set |next_index_| larger than the size of the buffer. |
| 99 next_index_ = std::min(value, Size()); | 100 next_index_ = std::min(value, Size()); |
| 100 } | 101 } |
| 101 | 102 |
| 102 void SyncBuffer::set_dtmf_index(size_t value) { | 103 void SyncBuffer::set_dtmf_index(size_t value) { |
| 103 // Cannot set |dtmf_index_| larger than the size of the buffer. | 104 // Cannot set |dtmf_index_| larger than the size of the buffer. |
| 104 dtmf_index_ = std::min(value, Size()); | 105 dtmf_index_ = std::min(value, Size()); |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace webrtc | 108 } // namespace webrtc |
| OLD | NEW |