| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 RTC_CHECK_LE(playout_cached_bytes_, bytes_per_10_ms_); | 108 RTC_CHECK_LE(playout_cached_bytes_, bytes_per_10_ms_); |
| 109 RTC_CHECK_EQ(static_cast<size_t>(-bytes_left), playout_cached_bytes_); | 109 RTC_CHECK_EQ(static_cast<size_t>(-bytes_left), playout_cached_bytes_); |
| 110 playout_cached_buffer_start_ = 0; | 110 playout_cached_buffer_start_ = 0; |
| 111 memcpy(playout_cache_buffer_.get(), cache_ptr, playout_cached_bytes_); | 111 memcpy(playout_cache_buffer_.get(), cache_ptr, playout_cached_bytes_); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void FineAudioBuffer::DeliverRecordedData(const int8_t* buffer, | 114 void FineAudioBuffer::DeliverRecordedData(const int8_t* buffer, |
| 115 size_t size_in_bytes, | 115 size_t size_in_bytes, |
| 116 int playout_delay_ms, | 116 int playout_delay_ms, |
| 117 int record_delay_ms) { | 117 int record_delay_ms) { |
| 118 RTC_CHECK_EQ(size_in_bytes, desired_frame_size_bytes_); | |
| 119 // Check if the temporary buffer can store the incoming buffer. If not, | 118 // Check if the temporary buffer can store the incoming buffer. If not, |
| 120 // move the remaining (old) bytes to the beginning of the temporary buffer | 119 // move the remaining (old) bytes to the beginning of the temporary buffer |
| 121 // and start adding new samples after the old samples. | 120 // and start adding new samples after the old samples. |
| 122 if (record_write_pos_ + size_in_bytes > required_record_buffer_size_bytes_) { | 121 if (record_write_pos_ + size_in_bytes > required_record_buffer_size_bytes_) { |
| 123 if (record_cached_bytes_ > 0) { | 122 if (record_cached_bytes_ > 0) { |
| 124 memmove(record_cache_buffer_.get(), | 123 memmove(record_cache_buffer_.get(), |
| 125 record_cache_buffer_.get() + record_read_pos_, | 124 record_cache_buffer_.get() + record_read_pos_, |
| 126 record_cached_bytes_); | 125 record_cached_bytes_); |
| 127 } | 126 } |
| 128 record_write_pos_ = record_cached_bytes_; | 127 record_write_pos_ = record_cached_bytes_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 141 device_buffer_->SetVQEData(playout_delay_ms, record_delay_ms, 0); | 140 device_buffer_->SetVQEData(playout_delay_ms, record_delay_ms, 0); |
| 142 device_buffer_->DeliverRecordedData(); | 141 device_buffer_->DeliverRecordedData(); |
| 143 // Read next chunk of 10ms data. | 142 // Read next chunk of 10ms data. |
| 144 record_read_pos_ += bytes_per_10_ms_; | 143 record_read_pos_ += bytes_per_10_ms_; |
| 145 // Reduce number of cached bytes with the consumed amount. | 144 // Reduce number of cached bytes with the consumed amount. |
| 146 record_cached_bytes_ -= bytes_per_10_ms_; | 145 record_cached_bytes_ -= bytes_per_10_ms_; |
| 147 } | 146 } |
| 148 } | 147 } |
| 149 | 148 |
| 150 } // namespace webrtc | 149 } // namespace webrtc |
| OLD | NEW |