OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 size_t Word32Align(size_t size) { | 64 size_t Word32Align(size_t size) { |
65 uint32_t remainder = size % 4; | 65 uint32_t remainder = size % 4; |
66 if (remainder != 0) | 66 if (remainder != 0) |
67 return size + 4 - remainder; | 67 return size + 4 - remainder; |
68 return size; | 68 return size; |
69 } | 69 } |
70 | 70 |
71 RtpHeaderParser::RtpHeaderParser(const uint8_t* rtpData, | 71 RtpHeaderParser::RtpHeaderParser(const uint8_t* rtpData, |
72 const size_t rtpDataLength) | 72 const size_t rtpDataLength) |
73 : _ptrRTPDataBegin(rtpData), | 73 : _ptrRTPDataBegin(rtpData), |
74 _ptrRTPDataEnd(rtpData ? (rtpData + rtpDataLength) : NULL) { | 74 _ptrRTPDataEnd(rtpData ? (rtpData + rtpDataLength) : nullptr) {} |
75 } | |
76 | 75 |
77 RtpHeaderParser::~RtpHeaderParser() { | 76 RtpHeaderParser::~RtpHeaderParser() { |
78 } | 77 } |
79 | 78 |
80 bool RtpHeaderParser::RTCP() const { | 79 bool RtpHeaderParser::RTCP() const { |
81 // 72 to 76 is reserved for RTP | 80 // 72 to 76 is reserved for RTP |
82 // 77 to 79 is not reserver but they are not assigned we will block them | 81 // 77 to 79 is not reserver but they are not assigned we will block them |
83 // for RTCP 200 SR == marker bit + 72 | 82 // for RTCP 200 SR == marker bit + 72 |
84 // for RTCP 204 APP == marker bit + 76 | 83 // for RTCP 204 APP == marker bit + 76 |
85 /* | 84 /* |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 case 205: | 143 case 205: |
145 case 206: | 144 case 206: |
146 case 207: | 145 case 207: |
147 return true; | 146 return true; |
148 default: | 147 default: |
149 return false; | 148 return false; |
150 } | 149 } |
151 } | 150 } |
152 | 151 |
153 bool RtpHeaderParser::ParseRtcp(RTPHeader* header) const { | 152 bool RtpHeaderParser::ParseRtcp(RTPHeader* header) const { |
154 assert(header != NULL); | 153 assert(header != nullptr); |
155 | 154 |
156 const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin; | 155 const ptrdiff_t length = _ptrRTPDataEnd - _ptrRTPDataBegin; |
157 if (length < kRtcpMinParseLength) { | 156 if (length < kRtcpMinParseLength) { |
158 return false; | 157 return false; |
159 } | 158 } |
160 | 159 |
161 const uint8_t V = _ptrRTPDataBegin[0] >> 6; | 160 const uint8_t V = _ptrRTPDataBegin[0] >> 6; |
162 if (V != kRtcpExpectedVersion) { | 161 if (V != kRtcpExpectedVersion) { |
163 return false; | 162 return false; |
164 } | 163 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 return; | 451 return; |
453 } | 452 } |
454 } | 453 } |
455 } | 454 } |
456 ptr += (len + 1); | 455 ptr += (len + 1); |
457 } | 456 } |
458 } | 457 } |
459 | 458 |
460 } // namespace RtpUtility | 459 } // namespace RtpUtility |
461 } // namespace webrtc | 460 } // namespace webrtc |
OLD | NEW |