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 12 matching lines...) Expand all Loading... |
23 rtp_rtcp_module_ = rtp_rtcp_module; | 23 rtp_rtcp_module_ = rtp_rtcp_module; |
24 rtp_payload_registry_ = payload_registry; | 24 rtp_payload_registry_ = payload_registry; |
25 rtp_receiver_ = receiver; | 25 rtp_receiver_ = receiver; |
26 receive_statistics_ = receive_statistics; | 26 receive_statistics_ = receive_statistics; |
27 } | 27 } |
28 | 28 |
29 void LoopBackTransport::DropEveryNthPacket(int n) { | 29 void LoopBackTransport::DropEveryNthPacket(int n) { |
30 packet_loss_ = n; | 30 packet_loss_ = n; |
31 } | 31 } |
32 | 32 |
33 int LoopBackTransport::SendPacket(const void* data, size_t len) { | 33 bool LoopBackTransport::SendRtp(const uint8_t* data, size_t len) { |
34 count_++; | 34 count_++; |
35 if (packet_loss_ > 0) { | 35 if (packet_loss_ > 0) { |
36 if ((count_ % packet_loss_) == 0) { | 36 if ((count_ % packet_loss_) == 0) { |
37 return len; | 37 return true; |
38 } | 38 } |
39 } | 39 } |
40 RTPHeader header; | 40 RTPHeader header; |
41 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); | 41 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); |
42 if (!parser->Parse(static_cast<const uint8_t*>(data), len, &header)) { | 42 if (!parser->Parse(static_cast<const uint8_t*>(data), len, &header)) { |
43 return -1; | 43 return false; |
44 } | 44 } |
45 PayloadUnion payload_specific; | 45 PayloadUnion payload_specific; |
46 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, | 46 if (!rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, |
47 &payload_specific)) { | 47 &payload_specific)) { |
48 return -1; | 48 return false; |
49 } | 49 } |
50 receive_statistics_->IncomingPacket(header, len, false); | 50 receive_statistics_->IncomingPacket(header, len, false); |
51 if (!rtp_receiver_->IncomingRtpPacket(header, | 51 if (!rtp_receiver_->IncomingRtpPacket(header, |
52 static_cast<const uint8_t*>(data), len, | 52 static_cast<const uint8_t*>(data), len, |
53 payload_specific, true)) { | 53 payload_specific, true)) { |
54 return -1; | 54 return false; |
55 } | 55 } |
56 return len; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 int LoopBackTransport::SendRTCPPacket(const void* data, size_t len) { | 59 bool LoopBackTransport::SendRtcp(const uint8_t* data, size_t len) { |
60 if (rtp_rtcp_module_->IncomingRtcpPacket((const uint8_t*)data, len) < 0) { | 60 if (rtp_rtcp_module_->IncomingRtcpPacket((const uint8_t*)data, len) < 0) { |
61 return -1; | 61 return false; |
62 } | 62 } |
63 return static_cast<int>(len); | 63 return true; |
64 } | 64 } |
65 | 65 |
66 int32_t TestRtpReceiver::OnReceivedPayloadData( | 66 int32_t TestRtpReceiver::OnReceivedPayloadData( |
67 const uint8_t* payload_data, | 67 const uint8_t* payload_data, |
68 const size_t payload_size, | 68 const size_t payload_size, |
69 const webrtc::WebRtcRTPHeader* rtp_header) { | 69 const webrtc::WebRtcRTPHeader* rtp_header) { |
70 EXPECT_LE(payload_size, sizeof(payload_data_)); | 70 EXPECT_LE(payload_size, sizeof(payload_data_)); |
71 memcpy(payload_data_, payload_data, payload_size); | 71 memcpy(payload_data_, payload_data, payload_size); |
72 memcpy(&rtp_header_, rtp_header, sizeof(rtp_header_)); | 72 memcpy(&rtp_header_, rtp_header, sizeof(rtp_header_)); |
73 payload_size_ = payload_size; | 73 payload_size_ = payload_size; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 RTPHeader rtx_header; | 175 RTPHeader rtx_header; |
176 rtx_header.ssrc = kRtxSsrc; | 176 rtx_header.ssrc = kRtxSsrc; |
177 rtx_header.payloadType = kRtxPayloadType; | 177 rtx_header.payloadType = kRtxPayloadType; |
178 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 178 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
179 rtx_header.ssrc = 0; | 179 rtx_header.ssrc = 0; |
180 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); | 180 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); |
181 rtx_header.ssrc = kRtxSsrc; | 181 rtx_header.ssrc = kRtxSsrc; |
182 rtx_header.payloadType = 0; | 182 rtx_header.payloadType = 0; |
183 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 183 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
184 } | 184 } |
OLD | NEW |