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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Verify that the content of the reconstructed packet is equal to the | 65 // Verify that the content of the reconstructed packet is equal to the |
66 // content of |packet|, and that the same content is received |times| number | 66 // content of |packet|, and that the same content is received |times| number |
67 // of times in a row. | 67 // of times in a row. |
68 EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, packet->length)) | 68 EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, packet->length)) |
69 .With(Args<0, 1>(ElementsAreArray(packet->data, | 69 .With(Args<0, 1>(ElementsAreArray(packet->data, |
70 packet->length))) | 70 packet->length))) |
71 .Times(times).WillRepeatedly(Return(true)); | 71 .Times(times).WillRepeatedly(Return(true)); |
72 } | 72 } |
73 | 73 |
74 void BuildAndAddRedMediaPacket(test::RawRtpPacket* packet) { | 74 void BuildAndAddRedMediaPacket(test::RawRtpPacket* packet) { |
75 test::RawRtpPacket* red_packet = generator_->BuildMediaRedPacket(packet); | 75 std::unique_ptr<test::RawRtpPacket> red_packet( |
| 76 generator_->BuildMediaRedPacket(packet)); |
76 EXPECT_EQ(0, receiver_fec_->AddReceivedRedPacket( | 77 EXPECT_EQ(0, receiver_fec_->AddReceivedRedPacket( |
77 red_packet->header.header, red_packet->data, | 78 red_packet->header.header, red_packet->data, |
78 red_packet->length, kFecPayloadType)); | 79 red_packet->length, kFecPayloadType)); |
79 delete red_packet; | |
80 } | 80 } |
81 | 81 |
82 void BuildAndAddRedFecPacket(Packet* packet) { | 82 void BuildAndAddRedFecPacket(Packet* packet) { |
83 test::RawRtpPacket* red_packet = generator_->BuildFecRedPacket(packet); | 83 std::unique_ptr<test::RawRtpPacket> red_packet( |
| 84 generator_->BuildFecRedPacket(packet)); |
84 EXPECT_EQ(0, receiver_fec_->AddReceivedRedPacket( | 85 EXPECT_EQ(0, receiver_fec_->AddReceivedRedPacket( |
85 red_packet->header.header, red_packet->data, | 86 red_packet->header.header, red_packet->data, |
86 red_packet->length, kFecPayloadType)); | 87 red_packet->length, kFecPayloadType)); |
87 delete red_packet; | |
88 } | 88 } |
89 | 89 |
90 void InjectGarbagePacketLength(size_t fec_garbage_offset); | 90 void InjectGarbagePacketLength(size_t fec_garbage_offset); |
91 static void SurvivesMaliciousPacket(const uint8_t* data, | 91 static void SurvivesMaliciousPacket(const uint8_t* data, |
92 size_t length, | 92 size_t length, |
93 uint8_t ulpfec_payload_type); | 93 uint8_t ulpfec_payload_type); |
94 | 94 |
95 MockRtpData rtp_data_callback_; | 95 MockRtpData rtp_data_callback_; |
96 std::unique_ptr<ForwardErrorCorrection> fec_; | 96 std::unique_ptr<ForwardErrorCorrection> fec_; |
97 std::unique_ptr<FecReceiver> receiver_fec_; | 97 std::unique_ptr<FecReceiver> receiver_fec_; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 0x27, | 504 0x27, |
505 0xc4, | 505 0xc4, |
506 0x2a, | 506 0x2a, |
507 0x21, | 507 0x21, |
508 0x2a, | 508 0x2a, |
509 0x28}; | 509 0x28}; |
510 SurvivesMaliciousPacket(kPacket, sizeof(kPacket), 100); | 510 SurvivesMaliciousPacket(kPacket, sizeof(kPacket), 100); |
511 } | 511 } |
512 | 512 |
513 } // namespace webrtc | 513 } // namespace webrtc |
OLD | NEW |