| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 // May not be present in packet. | 242 // May not be present in packet. |
| 243 header->extension.hasAudioLevel = false; | 243 header->extension.hasAudioLevel = false; |
| 244 header->extension.voiceActivity = false; | 244 header->extension.voiceActivity = false; |
| 245 header->extension.audioLevel = 0; | 245 header->extension.audioLevel = 0; |
| 246 | 246 |
| 247 // May not be present in packet. | 247 // May not be present in packet. |
| 248 header->extension.hasVideoRotation = false; | 248 header->extension.hasVideoRotation = false; |
| 249 header->extension.videoRotation = 0; | 249 header->extension.videoRotation = 0; |
| 250 | 250 |
| 251 // May not be present in packet. |
| 252 header->extension.playout_delay.min_ms = -1; |
| 253 header->extension.playout_delay.max_ms = -1; |
| 254 |
| 251 if (X) { | 255 if (X) { |
| 252 /* RTP header extension, RFC 3550. | 256 /* RTP header extension, RFC 3550. |
| 253 0 1 2 3 | 257 0 1 2 3 |
| 254 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 | 258 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 |
| 255 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 259 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 256 | defined by profile | length | | 260 | defined by profile | length | |
| 257 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 261 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 258 | header extension | | 262 | header extension | |
| 259 | .... | | 263 | .... | |
| 260 */ | 264 */ |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 404 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 401 // | ID | L=1 |transport wide sequence number | | 405 // | ID | L=1 |transport wide sequence number | |
| 402 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 406 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 403 | 407 |
| 404 uint16_t sequence_number = ptr[0] << 8; | 408 uint16_t sequence_number = ptr[0] << 8; |
| 405 sequence_number += ptr[1]; | 409 sequence_number += ptr[1]; |
| 406 header->extension.transportSequenceNumber = sequence_number; | 410 header->extension.transportSequenceNumber = sequence_number; |
| 407 header->extension.hasTransportSequenceNumber = true; | 411 header->extension.hasTransportSequenceNumber = true; |
| 408 break; | 412 break; |
| 409 } | 413 } |
| 414 case kRtpExtensionPlayoutDelay: { |
| 415 if (len != 2) { |
| 416 LOG(LS_WARNING) << "Incorrect playout delay len: " << len; |
| 417 return; |
| 418 } |
| 419 // 0 1 2 3 |
| 420 // 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 |
| 421 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 422 // | ID | len=2 | MIN delay | MAX delay | |
| 423 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 424 |
| 425 int min_playout_delay = (ptr[0] << 4) | ((ptr[1] >> 4) & 0xf); |
| 426 int max_playout_delay = ((ptr[1] & 0xf) << 8) | ptr[2]; |
| 427 header->extension.playout_delay.min_ms = |
| 428 min_playout_delay * kPlayoutDelayGranularityMs; |
| 429 header->extension.playout_delay.max_ms = |
| 430 max_playout_delay * kPlayoutDelayGranularityMs; |
| 431 break; |
| 432 } |
| 410 default: { | 433 default: { |
| 411 LOG(LS_WARNING) << "Extension type not implemented: " << type; | 434 LOG(LS_WARNING) << "Extension type not implemented: " << type; |
| 412 return; | 435 return; |
| 413 } | 436 } |
| 414 } | 437 } |
| 415 } | 438 } |
| 416 ptr += (len + 1); | 439 ptr += (len + 1); |
| 417 uint8_t num_bytes = ParsePaddingBytes(ptrRTPDataExtensionEnd, ptr); | 440 uint8_t num_bytes = ParsePaddingBytes(ptrRTPDataExtensionEnd, ptr); |
| 418 ptr += num_bytes; | 441 ptr += num_bytes; |
| 419 } | 442 } |
| 420 } | 443 } |
| 421 | 444 |
| 422 uint8_t RtpHeaderParser::ParsePaddingBytes( | 445 uint8_t RtpHeaderParser::ParsePaddingBytes( |
| 423 const uint8_t* ptrRTPDataExtensionEnd, | 446 const uint8_t* ptrRTPDataExtensionEnd, |
| 424 const uint8_t* ptr) const { | 447 const uint8_t* ptr) const { |
| 425 uint8_t num_zero_bytes = 0; | 448 uint8_t num_zero_bytes = 0; |
| 426 while (ptrRTPDataExtensionEnd - ptr > 0) { | 449 while (ptrRTPDataExtensionEnd - ptr > 0) { |
| 427 if (*ptr != 0) { | 450 if (*ptr != 0) { |
| 428 return num_zero_bytes; | 451 return num_zero_bytes; |
| 429 } | 452 } |
| 430 ptr++; | 453 ptr++; |
| 431 num_zero_bytes++; | 454 num_zero_bytes++; |
| 432 } | 455 } |
| 433 return num_zero_bytes; | 456 return num_zero_bytes; |
| 434 } | 457 } |
| 435 } // namespace RtpUtility | 458 } // namespace RtpUtility |
| 436 } // namespace webrtc | 459 } // namespace webrtc |
| OLD | NEW |