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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 RTPHeader header; | 45 RTPHeader header; |
46 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 46 std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
47 if (!parser->Parse(static_cast<const uint8_t*>(data), len, &header)) { | 47 if (!parser->Parse(static_cast<const uint8_t*>(data), len, &header)) { |
48 return false; | 48 return false; |
49 } | 49 } |
50 PayloadUnion payload_specific; | 50 PayloadUnion payload_specific; |
51 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, | 51 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, |
52 &payload_specific)) { | 52 &payload_specific)) { |
53 return false; | 53 return false; |
54 } | 54 } |
55 const uint8_t* payload = | |
56 static_cast<const uint8_t*>(data) + header.headerLength; | |
danilchap
2016/10/03 13:51:19
static_cast is not needed here (it casts to same t
ossu
2016/10/03 14:12:03
Acknowledged.
| |
57 assert(len >= header.headerLength); | |
danilchap
2016/10/03 13:51:19
RTC_DCHECK_GE(len, header.headerLength)
ossu
2016/10/03 14:12:03
You are right on both counts! I just borrowed this
| |
58 const size_t payload_length = len - header.headerLength; | |
danilchap
2016/10/03 13:51:19
may be just "size_t payload_length":
function tail
ossu
2016/10/03 14:12:03
Granted, it's not strictly necessary. However, I'm
| |
55 receive_statistics_->IncomingPacket(header, len, false); | 59 receive_statistics_->IncomingPacket(header, len, false); |
56 if (!rtp_receiver_->IncomingRtpPacket(header, | 60 if (!rtp_receiver_->IncomingRtpPacket(header, payload, payload_length, |
57 static_cast<const uint8_t*>(data), len, | |
58 payload_specific, true)) { | 61 payload_specific, true)) { |
59 return false; | 62 return false; |
60 } | 63 } |
61 return true; | 64 return true; |
62 } | 65 } |
63 | 66 |
64 bool LoopBackTransport::SendRtcp(const uint8_t* data, size_t len) { | 67 bool LoopBackTransport::SendRtcp(const uint8_t* data, size_t len) { |
65 if (rtp_rtcp_module_->IncomingRtcpPacket((const uint8_t*)data, len) < 0) { | 68 if (rtp_rtcp_module_->IncomingRtcpPacket((const uint8_t*)data, len) < 0) { |
66 return false; | 69 return false; |
67 } | 70 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 rtx_header.payloadType = kRtxPayloadType; | 185 rtx_header.payloadType = kRtxPayloadType; |
183 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 186 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
184 rtx_header.ssrc = 0; | 187 rtx_header.ssrc = 0; |
185 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); | 188 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); |
186 rtx_header.ssrc = kRtxSsrc; | 189 rtx_header.ssrc = kRtxSsrc; |
187 rtx_header.payloadType = 0; | 190 rtx_header.payloadType = 0; |
188 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 191 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
189 } | 192 } |
190 | 193 |
191 } // namespace webrtc | 194 } // namespace webrtc |
OLD | NEW |