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