OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return; | 204 return; |
205 } | 205 } |
206 | 206 |
207 // Extract the speech encoder from the ACM. | 207 // Extract the speech encoder from the ACM. |
208 std::unique_ptr<AudioEncoder> enc = std::move(*encoder); | 208 std::unique_ptr<AudioEncoder> enc = std::move(*encoder); |
209 while (true) { | 209 while (true) { |
210 auto sub_enc = enc->ReclaimContainedEncoders(); | 210 auto sub_enc = enc->ReclaimContainedEncoders(); |
211 if (sub_enc.empty()) { | 211 if (sub_enc.empty()) { |
212 break; | 212 break; |
213 } | 213 } |
214 RTC_CHECK_EQ(1u, sub_enc.size()); | 214 RTC_CHECK_EQ(1, sub_enc.size()); |
215 | 215 |
216 // Replace enc with its sub encoder. We need to put the sub encoder in | 216 // Replace enc with its sub encoder. We need to put the sub encoder in |
217 // a temporary first, since otherwise the old value of enc would be | 217 // a temporary first, since otherwise the old value of enc would be |
218 // destroyed before the new value got assigned, which would be bad | 218 // destroyed before the new value got assigned, which would be bad |
219 // since the new value is a part of the old value. | 219 // since the new value is a part of the old value. |
220 auto tmp_enc = std::move(sub_enc[0]); | 220 auto tmp_enc = std::move(sub_enc[0]); |
221 enc = std::move(tmp_enc); | 221 enc = std::move(tmp_enc); |
222 } | 222 } |
223 | 223 |
224 // Wrap it in a new encoder stack and put it back. | 224 // Wrap it in a new encoder stack and put it back. |
(...skipping 22 matching lines...) Expand all Loading... |
247 if (!stack) { | 247 if (!stack) { |
248 return false; | 248 return false; |
249 } | 249 } |
250 acm->SetEncoder(std::move(stack)); | 250 acm->SetEncoder(std::move(stack)); |
251 recreate_encoder_ = false; | 251 recreate_encoder_ = false; |
252 return true; | 252 return true; |
253 } | 253 } |
254 | 254 |
255 } // namespace acm2 | 255 } // namespace acm2 |
256 } // namespace webrtc | 256 } // namespace webrtc |
OLD | NEW |