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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 RenderDelayBufferImpl::~RenderDelayBufferImpl() = default; | 119 RenderDelayBufferImpl::~RenderDelayBufferImpl() = default; |
120 | 120 |
121 void RenderDelayBufferImpl::Reset() { | 121 void RenderDelayBufferImpl::Reset() { |
122 // Empty all data in the buffers. | 122 // Empty all data in the buffers. |
123 delay_ = 0; | 123 delay_ = 0; |
124 last_insert_index_ = 0; | 124 last_insert_index_ = 0; |
125 downsampled_render_buffer_.position = 0; | 125 downsampled_render_buffer_.position = 0; |
126 downsampled_render_buffer_.buffer.fill(0.f); | 126 downsampled_render_buffer_.buffer.fill(0.f); |
127 fft_buffer_.Clear(); | 127 fft_buffer_.Clear(); |
128 api_call_jitter_buffer_.Reset(); | 128 api_call_jitter_buffer_.Reset(); |
129 for (auto& c : buffer_) { | |
peah-webrtc
2017/04/06 13:39:08
After a buffer delay reset (due to a too long buff
| |
130 for (auto& b : c) { | |
131 std::fill(b.begin(), b.end(), 0.f); | |
132 } | |
133 } | |
129 } | 134 } |
130 | 135 |
131 bool RenderDelayBufferImpl::Insert(std::vector<std::vector<float>>* block) { | 136 bool RenderDelayBufferImpl::Insert(std::vector<std::vector<float>>* block) { |
132 RTC_DCHECK_EQ(block->size(), buffer_[0].size()); | 137 RTC_DCHECK_EQ(block->size(), buffer_[0].size()); |
133 RTC_DCHECK_EQ((*block)[0].size(), buffer_[0][0].size()); | 138 RTC_DCHECK_EQ((*block)[0].size(), buffer_[0][0].size()); |
134 | 139 |
135 if (api_call_jitter_buffer_.Full()) { | 140 if (api_call_jitter_buffer_.Full()) { |
136 // Report buffer overrun and let the caller handle the overrun. | 141 // Report buffer overrun and let the caller handle the overrun. |
137 return false; | 142 return false; |
138 } | 143 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 } | 200 } |
196 } | 201 } |
197 | 202 |
198 } // namespace | 203 } // namespace |
199 | 204 |
200 RenderDelayBuffer* RenderDelayBuffer::Create(size_t num_bands) { | 205 RenderDelayBuffer* RenderDelayBuffer::Create(size_t num_bands) { |
201 return new RenderDelayBufferImpl(num_bands); | 206 return new RenderDelayBufferImpl(num_bands); |
202 } | 207 } |
203 | 208 |
204 } // namespace webrtc | 209 } // namespace webrtc |
OLD | NEW |