OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 16 matching lines...) Expand all Loading... |
27 // |V=2|P| SC | PT=BYE=203 | length | | 27 // |V=2|P| SC | PT=BYE=203 | length | |
28 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 28 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
29 // | SSRC/CSRC | | 29 // | SSRC/CSRC | |
30 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 30 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
31 // : ... : | 31 // : ... : |
32 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ | 32 // +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |
33 // (opt) | length | reason for leaving ... | 33 // (opt) | length | reason for leaving ... |
34 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 34 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
35 Bye::Bye() : sender_ssrc_(0) {} | 35 Bye::Bye() : sender_ssrc_(0) {} |
36 | 36 |
| 37 Bye::~Bye() = default; |
| 38 |
37 bool Bye::Parse(const CommonHeader& packet) { | 39 bool Bye::Parse(const CommonHeader& packet) { |
38 RTC_DCHECK_EQ(packet.type(), kPacketType); | 40 RTC_DCHECK_EQ(packet.type(), kPacketType); |
39 | 41 |
40 const uint8_t src_count = packet.count(); | 42 const uint8_t src_count = packet.count(); |
41 // Validate packet. | 43 // Validate packet. |
42 if (packet.payload_size_bytes() < 4u * src_count) { | 44 if (packet.payload_size_bytes() < 4u * src_count) { |
43 LOG(LS_WARNING) | 45 LOG(LS_WARNING) |
44 << "Packet is too small to contain CSRCs it promise to have."; | 46 << "Packet is too small to contain CSRCs it promise to have."; |
45 return false; | 47 return false; |
46 } | 48 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 128 } |
127 | 129 |
128 size_t Bye::BlockLength() const { | 130 size_t Bye::BlockLength() const { |
129 size_t src_count = (1 + csrcs_.size()); | 131 size_t src_count = (1 + csrcs_.size()); |
130 size_t reason_size_in_32bits = reason_.empty() ? 0 : (reason_.size() / 4 + 1); | 132 size_t reason_size_in_32bits = reason_.empty() ? 0 : (reason_.size() / 4 + 1); |
131 return kHeaderLength + 4 * (src_count + reason_size_in_32bits); | 133 return kHeaderLength + 4 * (src_count + reason_size_in_32bits); |
132 } | 134 } |
133 | 135 |
134 } // namespace rtcp | 136 } // namespace rtcp |
135 } // namespace webrtc | 137 } // namespace webrtc |
OLD | NEW |