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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 if (first_symbol_cardinality_ <= capacity) { | 440 if (first_symbol_cardinality_ <= capacity) { |
441 symbol_vec_.push_back(symbol); | 441 symbol_vec_.push_back(symbol); |
442 } else if (first_symbol_cardinality_ == kRunLengthCapacity) { | 442 } else if (first_symbol_cardinality_ == kRunLengthCapacity) { |
443 // Max length for an RLE-chunk reached. | 443 // Max length for an RLE-chunk reached. |
444 EmitRunLengthChunk(); | 444 EmitRunLengthChunk(); |
445 } | 445 } |
446 size_bytes_ += delta_size; | 446 size_bytes_ += delta_size; |
447 return true; | 447 return true; |
448 } else { | 448 } else { |
449 // New symbol does not match what's already in symbol_vec. | 449 // New symbol does not match what's already in symbol_vec. |
450 if (first_symbol_cardinality_ > capacity) { | 450 if (first_symbol_cardinality_ >= capacity) { |
451 // Symbols in symbol_vec can only be RLE-encoded. Emit the RLE-chunk | 451 // Symbols in symbol_vec can only be RLE-encoded. Emit the RLE-chunk |
452 // and re-add input. symbol_vec is then guaranteed to have room for the | 452 // and re-add input. symbol_vec is then guaranteed to have room for the |
453 // symbol, so recursion cannot continue. | 453 // symbol, so recursion cannot continue. |
454 EmitRunLengthChunk(); | 454 EmitRunLengthChunk(); |
455 return Encode(symbol); | 455 return Encode(symbol); |
456 } | 456 } |
457 // Fall through and treat state as non RLE-candidate. | 457 // Fall through and treat state as non RLE-candidate. |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 "RLE block of size " << rle_chunk->NumSymbols() | 767 "RLE block of size " << rle_chunk->NumSymbols() |
768 << " but only " << max_size << " left to read."; | 768 << " but only " << max_size << " left to read."; |
769 delete rle_chunk; | 769 delete rle_chunk; |
770 return nullptr; | 770 return nullptr; |
771 } | 771 } |
772 return rle_chunk; | 772 return rle_chunk; |
773 } | 773 } |
774 | 774 |
775 } // namespace rtcp | 775 } // namespace rtcp |
776 } // namespace webrtc | 776 } // namespace webrtc |
OLD | NEW |