OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 RenderDelayBufferImpl::~RenderDelayBufferImpl() = default; | 117 RenderDelayBufferImpl::~RenderDelayBufferImpl() = default; |
118 | 118 |
119 void RenderDelayBufferImpl::Reset() { | 119 void RenderDelayBufferImpl::Reset() { |
120 // Empty all data in the buffers. | 120 // Empty all data in the buffers. |
121 delay_ = 0; | 121 delay_ = 0; |
122 last_insert_index_ = 0; | 122 last_insert_index_ = 0; |
123 downsampled_render_buffer_.position = 0; | 123 downsampled_render_buffer_.position = 0; |
124 downsampled_render_buffer_.buffer.fill(0.f); | 124 downsampled_render_buffer_.buffer.fill(0.f); |
125 fft_buffer_.Clear(); | 125 fft_buffer_.Clear(); |
126 api_call_jitter_buffer_.Reset(); | 126 api_call_jitter_buffer_.Reset(); |
| 127 for (auto& c : buffer_) { |
| 128 for (auto& b : c) { |
| 129 std::fill(b.begin(), b.end(), 0.f); |
| 130 } |
| 131 } |
127 } | 132 } |
128 | 133 |
129 bool RenderDelayBufferImpl::Insert( | 134 bool RenderDelayBufferImpl::Insert( |
130 const std::vector<std::vector<float>>& block) { | 135 const std::vector<std::vector<float>>& block) { |
131 RTC_DCHECK_EQ(block.size(), buffer_[0].size()); | 136 RTC_DCHECK_EQ(block.size(), buffer_[0].size()); |
132 RTC_DCHECK_EQ(block[0].size(), buffer_[0][0].size()); | 137 RTC_DCHECK_EQ(block[0].size(), buffer_[0][0].size()); |
133 | 138 |
134 if (api_call_jitter_buffer_.Full()) { | 139 if (api_call_jitter_buffer_.Full()) { |
135 // Report buffer overrun and let the caller handle the overrun. | 140 // Report buffer overrun and let the caller handle the overrun. |
136 return false; | 141 return false; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 199 } |
195 } | 200 } |
196 | 201 |
197 } // namespace | 202 } // namespace |
198 | 203 |
199 RenderDelayBuffer* RenderDelayBuffer::Create(size_t num_bands) { | 204 RenderDelayBuffer* RenderDelayBuffer::Create(size_t num_bands) { |
200 return new RenderDelayBufferImpl(num_bands); | 205 return new RenderDelayBufferImpl(num_bands); |
201 } | 206 } |
202 | 207 |
203 } // namespace webrtc | 208 } // namespace webrtc |
OLD | NEW |