Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
| 22 #include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h" | 22 #include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h" |
| 23 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" | 23 #include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h" |
| 24 | 24 |
| 25 namespace webrtc { | 25 namespace webrtc { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 constexpr uint8_t kFecPayloadType = 96; | 28 constexpr uint8_t kFecPayloadType = 96; |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 using ::testing::_; | 31 using ::testing::_; |
|
danilchap
2016/09/21 11:26:45
move all using inside unnamed namespace
brandtr
2016/09/21 12:54:07
Done.
| |
| 32 using ::testing::Args; | 32 using ::testing::Args; |
| 33 using ::testing::ElementsAreArray; | 33 using ::testing::ElementsAreArray; |
| 34 using ::testing::Return; | 34 using ::testing::Return; |
| 35 | 35 |
| 36 using ::webrtc::test::fec::FrameGenerator; | |
| 37 using Packet = ::webrtc::ForwardErrorCorrection::Packet; | 36 using Packet = ::webrtc::ForwardErrorCorrection::Packet; |
| 38 using ::webrtc::test::fec::RawRtpPacket; | 37 using ::webrtc::test::fec::RawRtpPacket; |
| 38 using ::webrtc::test::fec::UlpfecPacketGenerator; | |
|
danilchap
2016/09/21 11:26:45
'::webrtc::' can be removed actually (that likely
brandtr
2016/09/21 12:54:07
Ok :)
Changing in Ulpfec/Flexfec unit tests as we
| |
| 39 | 39 |
| 40 class ReceiverFecTest : public ::testing::Test { | 40 class ReceiverFecTest : public ::testing::Test { |
| 41 protected: | 41 protected: |
| 42 ReceiverFecTest() | 42 ReceiverFecTest() |
| 43 : fec_(ForwardErrorCorrection::CreateUlpfec()), | 43 : fec_(ForwardErrorCorrection::CreateUlpfec()), |
| 44 receiver_fec_(FecReceiver::Create(&rtp_data_callback_)) {} | 44 receiver_fec_(FecReceiver::Create(&rtp_data_callback_)) {} |
| 45 | 45 |
| 46 void EncodeFec(ForwardErrorCorrection::PacketList* media_packets, | 46 void EncodeFec(ForwardErrorCorrection::PacketList* media_packets, |
| 47 std::list<ForwardErrorCorrection::Packet*>* fec_packets, | 47 std::list<ForwardErrorCorrection::Packet*>* fec_packets, |
| 48 unsigned int num_fec_packets) { | 48 unsigned int num_fec_packets) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 } | 92 } |
| 93 | 93 |
| 94 void InjectGarbagePacketLength(size_t fec_garbage_offset); | 94 void InjectGarbagePacketLength(size_t fec_garbage_offset); |
| 95 static void SurvivesMaliciousPacket(const uint8_t* data, | 95 static void SurvivesMaliciousPacket(const uint8_t* data, |
| 96 size_t length, | 96 size_t length, |
| 97 uint8_t ulpfec_payload_type); | 97 uint8_t ulpfec_payload_type); |
| 98 | 98 |
| 99 MockRtpData rtp_data_callback_; | 99 MockRtpData rtp_data_callback_; |
| 100 std::unique_ptr<ForwardErrorCorrection> fec_; | 100 std::unique_ptr<ForwardErrorCorrection> fec_; |
| 101 std::unique_ptr<FecReceiver> receiver_fec_; | 101 std::unique_ptr<FecReceiver> receiver_fec_; |
| 102 FrameGenerator generator_; | 102 UlpfecPacketGenerator generator_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 TEST_F(ReceiverFecTest, TwoMediaOneFec) { | 105 TEST_F(ReceiverFecTest, TwoMediaOneFec) { |
| 106 const unsigned int kNumFecPackets = 1u; | 106 const unsigned int kNumFecPackets = 1u; |
| 107 std::list<RawRtpPacket*> media_rtp_packets; | 107 std::list<RawRtpPacket*> media_rtp_packets; |
| 108 ForwardErrorCorrection::PacketList media_packets; | 108 ForwardErrorCorrection::PacketList media_packets; |
| 109 GenerateFrame(2, 0, &media_rtp_packets, &media_packets); | 109 GenerateFrame(2, 0, &media_rtp_packets, &media_packets); |
| 110 std::list<ForwardErrorCorrection::Packet*> fec_packets; | 110 std::list<ForwardErrorCorrection::Packet*> fec_packets; |
| 111 EncodeFec(&media_packets, &fec_packets, kNumFecPackets); | 111 EncodeFec(&media_packets, &fec_packets, kNumFecPackets); |
| 112 | 112 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 0x27, | 508 0x27, |
| 509 0xc4, | 509 0xc4, |
| 510 0x2a, | 510 0x2a, |
| 511 0x21, | 511 0x21, |
| 512 0x2a, | 512 0x2a, |
| 513 0x28}; | 513 0x28}; |
| 514 SurvivesMaliciousPacket(kPacket, sizeof(kPacket), 100); | 514 SurvivesMaliciousPacket(kPacket, sizeof(kPacket), 100); |
| 515 } | 515 } |
| 516 | 516 |
| 517 } // namespace webrtc | 517 } // namespace webrtc |
| OLD | NEW |