Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/rtp_utils.h" | 5 #include "remoting/protocol/rtp_utils.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "third_party/libjingle/source/talk/base/byteorder.h" | 8 #include "third_party/libjingle/source/talk/base/byteorder.h" |
| 9 | 9 |
| 10 using talk_base::GetBE16; | 10 using talk_base::GetBE16; |
| 11 using talk_base::GetBE32; | 11 using talk_base::GetBE32; |
| 12 using talk_base::SetBE16; | 12 using talk_base::SetBE16; |
| 13 using talk_base::SetBE32; | 13 using talk_base::SetBE32; |
| 14 | 14 |
| 15 namespace remoting { | 15 namespace remoting { |
| 16 namespace protocol { | 16 namespace protocol { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 const int kRtpBaseHeaderSize = 12; | 19 const int kRtpBaseHeaderSize = 12; |
| 20 const uint8 kRtpVersionNumber = 2; | 20 const uint8 kRtpVersionNumber = 2; |
| 21 const int kRtpMaxSources = 16; | 21 const int kRtpMaxSources = 16; |
| 22 const int kBytesPerCSRC = 4; | 22 const int kBytesPerCSRC = 4; |
| 23 const int kRtcpBaseHeaderSize = 4; | 23 const int kRtcpBaseHeaderSize = 4; |
| 24 const int kRtcpReceiverReportSize = 28; | 24 const int kRtcpReceiverReportSize = 28; |
| 25 const int kRtcpReceiverReportTotalSize = | 25 const int kRtcpReceiverReportTotalSize = |
| 26 kRtcpBaseHeaderSize + kRtcpReceiverReportSize; | 26 kRtcpBaseHeaderSize + kRtcpReceiverReportSize; |
| 27 const int kRtcpReceiverReportPacketType = 201; | 27 const int kRtcpReceiverReportPacketType = 201; |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 RtpHeader::RtpHeader() | |
| 31 : padding(false), | |
| 32 extension(false), | |
| 33 sources(0), | |
| 34 marker(false), | |
| 35 payload_type(0), | |
| 36 sequence_number(0), | |
| 37 timestamp(0), | |
| 38 sync_source_id(0) { | |
| 39 } | |
| 40 | |
| 41 RtcpReceiverReport::RtcpReceiverReport() | |
| 42 : receiver_ssrc(0), | |
| 43 sender_ssrc(0), | |
| 44 loss_fraction(0), | |
| 45 total_lost_packets(0), | |
| 46 last_sequence_number(0), | |
| 47 jitter(0), | |
| 48 last_sender_report_timestamp(0), | |
| 49 last_sender_report_delay(0) { | |
| 50 } | |
| 51 | |
| 52 | |
|
Sergey Ulanov
2010/12/07 21:15:42
empty lines.
Elliot Glaysher
2010/12/07 21:49:25
Done.
| |
| 53 | |
| 30 static inline uint8 ExtractBits(uint8 byte, int bits_count, int shift) { | 54 static inline uint8 ExtractBits(uint8 byte, int bits_count, int shift) { |
| 31 return (byte >> shift) & ((1 << bits_count) - 1); | 55 return (byte >> shift) & ((1 << bits_count) - 1); |
| 32 } | 56 } |
| 33 | 57 |
| 34 // RTP Header format: | 58 // RTP Header format: |
| 35 // | 59 // |
| 36 // 0 1 2 3 | 60 // 0 1 2 3 |
| 37 // 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 | 61 // 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 |
| 38 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 62 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 39 // |V=2|P|X| CC |M| PT | sequence number | | 63 // |V=2|P|X| CC |M| PT | sequence number | |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 | 350 |
| 327 descriptor->picture_id |= buffer[pos] & 0x7F; | 351 descriptor->picture_id |= buffer[pos] & 0x7F; |
| 328 extension = (buffer[pos] & 0x80) != 0; | 352 extension = (buffer[pos] & 0x80) != 0; |
| 329 pos += 1; | 353 pos += 1; |
| 330 } | 354 } |
| 331 return pos; | 355 return pos; |
| 332 } | 356 } |
| 333 | 357 |
| 334 } // namespace protocol | 358 } // namespace protocol |
| 335 } // namespace remoting | 359 } // namespace remoting |
| OLD | NEW |