OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 payload_size_ = size - payload_offset_ - padding_size_; | 409 payload_size_ = size - payload_offset_ - padding_size_; |
410 return true; | 410 return true; |
411 } | 411 } |
412 | 412 |
413 bool Packet::FindExtension(ExtensionType type, | 413 bool Packet::FindExtension(ExtensionType type, |
414 uint8_t length, | 414 uint8_t length, |
415 uint16_t* offset) const { | 415 uint16_t* offset) const { |
416 RTC_DCHECK(offset); | 416 RTC_DCHECK(offset); |
417 for (size_t i = 0; i < num_extensions_; ++i) { | 417 for (size_t i = 0; i < num_extensions_; ++i) { |
418 if (extension_entries_[i].type == type) { | 418 if (extension_entries_[i].type == type) { |
419 if (length != extension_entries_[i].length) { | 419 RTC_CHECK_EQ(length, extension_entries_[i].length) |
420 LOG(LS_WARNING) << "Length mismatch for extension '" << type | 420 << "Length mismatch for extension '" << type << "'" |
421 << "': expected " << static_cast<int>(length) | 421 << "should be " << length << ", received " |
422 << ", received " | 422 << extension_entries_[i].length; |
423 << static_cast<int>(extension_entries_[i].length); | |
424 return false; | |
425 } | |
426 *offset = extension_entries_[i].offset; | 423 *offset = extension_entries_[i].offset; |
427 return true; | 424 return true; |
428 } | 425 } |
429 } | 426 } |
430 return false; | 427 return false; |
431 } | 428 } |
432 | 429 |
433 bool Packet::AllocateExtension(ExtensionType type, | 430 bool Packet::AllocateExtension(ExtensionType type, |
434 uint8_t length, | 431 uint8_t length, |
435 uint16_t* offset) { | 432 uint16_t* offset) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 uint8_t* Packet::WriteAt(size_t offset) { | 500 uint8_t* Packet::WriteAt(size_t offset) { |
504 return buffer_.data() + offset; | 501 return buffer_.data() + offset; |
505 } | 502 } |
506 | 503 |
507 void Packet::WriteAt(size_t offset, uint8_t byte) { | 504 void Packet::WriteAt(size_t offset, uint8_t byte) { |
508 buffer_.data()[offset] = byte; | 505 buffer_.data()[offset] = byte; |
509 } | 506 } |
510 | 507 |
511 } // namespace rtp | 508 } // namespace rtp |
512 } // namespace webrtc | 509 } // namespace webrtc |
OLD | NEW |