Add rtcp::CommonHeader::packet_size function

as an alternative to NextPacket function
to allow cleaner iterating over stacked rtcp packets.

Bug: webrtc:5565
Change-Id: I261afe2684e5fcb5fa3e7bcce272fbefeebd0b66
Reviewed-on: https://webrtc-review.googlesource.com/21360
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20615}
This commit is contained in:
Danil Chapovalov
2017-11-08 16:19:08 +01:00
committed by Commit Bot
parent 29cb0e7f70
commit eb0ed28b90
3 changed files with 13 additions and 7 deletions

View File

@ -15,6 +15,7 @@
namespace webrtc {
namespace rtcp {
constexpr size_t CommonHeader::kHeaderSizeBytes;
// 0 1 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@ -27,7 +28,6 @@ namespace rtcp {
//
// Common header for all RTCP packets, 4 octets.
bool CommonHeader::Parse(const uint8_t* buffer, size_t size_bytes) {
const size_t kHeaderSizeBytes = 4;
const uint8_t kVersion = 2;
if (size_bytes < kHeaderSizeBytes) {