OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 window_(new float[block_size_]), | 118 window_(new float[block_size_]), |
119 shift_amount_(shift_amount), | 119 shift_amount_(shift_amount), |
120 callback_(callback) { | 120 callback_(callback) { |
121 RTC_CHECK_LE(num_output_channels_, num_input_channels_); | 121 RTC_CHECK_LE(num_output_channels_, num_input_channels_); |
122 RTC_CHECK_LE(shift_amount_, block_size_); | 122 RTC_CHECK_LE(shift_amount_, block_size_); |
123 | 123 |
124 memcpy(window_.get(), window, block_size_ * sizeof(*window_.get())); | 124 memcpy(window_.get(), window, block_size_ * sizeof(*window_.get())); |
125 input_buffer_.MoveReadPositionBackward(initial_delay_); | 125 input_buffer_.MoveReadPositionBackward(initial_delay_); |
126 } | 126 } |
127 | 127 |
| 128 Blocker::~Blocker() = default; |
| 129 |
128 // When block_size < chunk_size the input and output buffers look like this: | 130 // When block_size < chunk_size the input and output buffers look like this: |
129 // | 131 // |
130 // delay* chunk_size chunk_size + delay* | 132 // delay* chunk_size chunk_size + delay* |
131 // buffer: <-------------|---------------------|---------------|> | 133 // buffer: <-------------|---------------------|---------------|> |
132 // _a_ _b_ _c_ | 134 // _a_ _b_ _c_ |
133 // | 135 // |
134 // On each call to ProcessChunk(): | 136 // On each call to ProcessChunk(): |
135 // 1. New input gets read into sections _b_ and _c_ of the input buffer. | 137 // 1. New input gets read into sections _b_ and _c_ of the input buffer. |
136 // 2. We block starting from frame_offset. | 138 // 2. We block starting from frame_offset. |
137 // 3. We block until we reach a block |bl| that doesn't contain any frames | 139 // 3. We block until we reach a block |bl| that doesn't contain any frames |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 ZeroOut(output_buffer_.channels(), | 229 ZeroOut(output_buffer_.channels(), |
228 initial_delay_, | 230 initial_delay_, |
229 chunk_size_, | 231 chunk_size_, |
230 num_output_channels_); | 232 num_output_channels_); |
231 | 233 |
232 // Calculate new starting frames. | 234 // Calculate new starting frames. |
233 frame_offset_ = first_frame_in_block - chunk_size_; | 235 frame_offset_ = first_frame_in_block - chunk_size_; |
234 } | 236 } |
235 | 237 |
236 } // namespace webrtc | 238 } // namespace webrtc |
OLD | NEW |