OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 void Packet::DeleteRedHeaders(std::list<RTPHeader*>* headers) { | 122 void Packet::DeleteRedHeaders(std::list<RTPHeader*>* headers) { |
123 while (!headers->empty()) { | 123 while (!headers->empty()) { |
124 delete headers->front(); | 124 delete headers->front(); |
125 headers->pop_front(); | 125 headers->pop_front(); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 bool Packet::ParseHeader(const RtpHeaderParser& parser) { | 129 bool Packet::ParseHeader(const RtpHeaderParser& parser) { |
130 bool valid_header = parser.Parse( | 130 bool valid_header = parser.Parse( |
131 payload_memory_.get(), static_cast<int>(packet_length_bytes_), &header_); | 131 payload_memory_.get(), static_cast<int>(packet_length_bytes_), &header_); |
132 assert(valid_header); | 132 // Special case for dummy packets that have padding marked in the RTP header. |
133 if (!valid_header) { | 133 // This causes the RTP header parser to report failure, but is fine in this |
| 134 // context. |
| 135 const bool header_only_with_padding = |
| 136 (header_.headerLength == packet_length_bytes_ && |
| 137 header_.paddingLength > 0); |
| 138 if (!valid_header && !header_only_with_padding) { |
134 return false; | 139 return false; |
135 } | 140 } |
136 assert(header_.headerLength <= packet_length_bytes_); | 141 assert(header_.headerLength <= packet_length_bytes_); |
137 payload_ = &payload_memory_[header_.headerLength]; | 142 payload_ = &payload_memory_[header_.headerLength]; |
138 assert(packet_length_bytes_ >= header_.headerLength); | 143 assert(packet_length_bytes_ >= header_.headerLength); |
139 payload_length_bytes_ = packet_length_bytes_ - header_.headerLength; | 144 payload_length_bytes_ = packet_length_bytes_ - header_.headerLength; |
140 RTC_CHECK_GE(virtual_packet_length_bytes_, packet_length_bytes_); | 145 RTC_CHECK_GE(virtual_packet_length_bytes_, packet_length_bytes_); |
141 assert(virtual_packet_length_bytes_ >= header_.headerLength); | 146 assert(virtual_packet_length_bytes_ >= header_.headerLength); |
142 virtual_payload_length_bytes_ = | 147 virtual_payload_length_bytes_ = |
143 virtual_packet_length_bytes_ - header_.headerLength; | 148 virtual_packet_length_bytes_ - header_.headerLength; |
(...skipping 12 matching lines...) Expand all Loading... |
156 destination->payload_type_frequency = header_.payload_type_frequency; | 161 destination->payload_type_frequency = header_.payload_type_frequency; |
157 memcpy(&destination->arrOfCSRCs, | 162 memcpy(&destination->arrOfCSRCs, |
158 &header_.arrOfCSRCs, | 163 &header_.arrOfCSRCs, |
159 sizeof(header_.arrOfCSRCs)); | 164 sizeof(header_.arrOfCSRCs)); |
160 memcpy( | 165 memcpy( |
161 &destination->extension, &header_.extension, sizeof(header_.extension)); | 166 &destination->extension, &header_.extension, sizeof(header_.extension)); |
162 } | 167 } |
163 | 168 |
164 } // namespace test | 169 } // namespace test |
165 } // namespace webrtc | 170 } // namespace webrtc |
OLD | NEW |