| 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 |
| 11 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 11 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 12 | 12 |
| 13 #include <string.h> | 13 #include <string.h> |
| 14 | 14 |
| 15 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
| 16 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" | 16 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" |
| 17 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 17 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 18 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" |
| 18 | 19 |
| 19 namespace webrtc { | 20 namespace webrtc { |
| 20 | 21 |
| 21 RtpData* NullObjectRtpData() { | 22 RtpData* NullObjectRtpData() { |
| 22 static NullRtpData null_rtp_data; | 23 static NullRtpData null_rtp_data; |
| 23 return &null_rtp_data; | 24 return &null_rtp_data; |
| 24 } | 25 } |
| 25 | 26 |
| 26 RtpFeedback* NullObjectRtpFeedback() { | 27 RtpFeedback* NullObjectRtpFeedback() { |
| 27 static NullRtpFeedback null_rtp_feedback; | 28 static NullRtpFeedback null_rtp_feedback; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 ptr += 2; | 275 ptr += 2; |
| 275 | 276 |
| 276 // in 32 bit words | 277 // in 32 bit words |
| 277 size_t XLen = ByteReader<uint16_t>::ReadBigEndian(ptr); | 278 size_t XLen = ByteReader<uint16_t>::ReadBigEndian(ptr); |
| 278 ptr += 2; | 279 ptr += 2; |
| 279 XLen *= 4; // in bytes | 280 XLen *= 4; // in bytes |
| 280 | 281 |
| 281 if (static_cast<size_t>(remain) < (4 + XLen)) { | 282 if (static_cast<size_t>(remain) < (4 + XLen)) { |
| 282 return false; | 283 return false; |
| 283 } | 284 } |
| 285 static constexpr uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE; |
| 284 if (definedByProfile == kRtpOneByteHeaderExtensionId) { | 286 if (definedByProfile == kRtpOneByteHeaderExtensionId) { |
| 285 const uint8_t* ptrRTPDataExtensionEnd = ptr + XLen; | 287 const uint8_t* ptrRTPDataExtensionEnd = ptr + XLen; |
| 286 ParseOneByteExtensionHeader(header, | 288 ParseOneByteExtensionHeader(header, |
| 287 ptrExtensionMap, | 289 ptrExtensionMap, |
| 288 ptrRTPDataExtensionEnd, | 290 ptrRTPDataExtensionEnd, |
| 289 ptr); | 291 ptr); |
| 290 } | 292 } |
| 291 header->headerLength += XLen; | 293 header->headerLength += XLen; |
| 292 } | 294 } |
| 293 if (header->headerLength + header->paddingLength > | 295 if (header->headerLength + header->paddingLength > |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 434 } |
| 433 // 0 1 2 3 | 435 // 0 1 2 3 |
| 434 // 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 | 436 // 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 |
| 435 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 437 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 436 // | ID | len=2 | MIN delay | MAX delay | | 438 // | ID | len=2 | MIN delay | MAX delay | |
| 437 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 439 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 438 | 440 |
| 439 int min_playout_delay = (ptr[0] << 4) | ((ptr[1] >> 4) & 0xf); | 441 int min_playout_delay = (ptr[0] << 4) | ((ptr[1] >> 4) & 0xf); |
| 440 int max_playout_delay = ((ptr[1] & 0xf) << 8) | ptr[2]; | 442 int max_playout_delay = ((ptr[1] & 0xf) << 8) | ptr[2]; |
| 441 header->extension.playout_delay.min_ms = | 443 header->extension.playout_delay.min_ms = |
| 442 min_playout_delay * kPlayoutDelayGranularityMs; | 444 min_playout_delay * PlayoutDelayLimits::kGranularityMs; |
| 443 header->extension.playout_delay.max_ms = | 445 header->extension.playout_delay.max_ms = |
| 444 max_playout_delay * kPlayoutDelayGranularityMs; | 446 max_playout_delay * PlayoutDelayLimits::kGranularityMs; |
| 445 break; | 447 break; |
| 446 } | 448 } |
| 447 case kRtpExtensionNone: | 449 case kRtpExtensionNone: |
| 448 case kRtpExtensionNumberOfExtensions: { | 450 case kRtpExtensionNumberOfExtensions: { |
| 449 RTC_NOTREACHED() << "Invalid extension type: " << type; | 451 RTC_NOTREACHED() << "Invalid extension type: " << type; |
| 450 return; | 452 return; |
| 451 } | 453 } |
| 452 } | 454 } |
| 453 } | 455 } |
| 454 ptr += (len + 1); | 456 ptr += (len + 1); |
| 455 } | 457 } |
| 456 } | 458 } |
| 457 | 459 |
| 458 } // namespace RtpUtility | 460 } // namespace RtpUtility |
| 459 } // namespace webrtc | 461 } // namespace webrtc |
| OLD | NEW |