Rename FecReceiver to UlpfecReceiver.
BUG=webrtc:5654
Review-Url: https://codereview.webrtc.org/2451643002
Cr-Commit-Position: refs/heads/master@{#14846}
diff --git a/webrtc/modules/BUILD.gn b/webrtc/modules/BUILD.gn
index b444e80..c5330ea 100644
--- a/webrtc/modules/BUILD.gn
+++ b/webrtc/modules/BUILD.gn
@@ -413,7 +413,6 @@
"remote_bitrate_estimator/test/estimators/nada_unittest.cc",
"remote_bitrate_estimator/test/metric_recorder_unittest.cc",
"rtp_rtcp/source/byte_io_unittest.cc",
- "rtp_rtcp/source/fec_receiver_unittest.cc",
"rtp_rtcp/source/fec_test_helper.cc",
"rtp_rtcp/source/fec_test_helper.h",
"rtp_rtcp/source/flexfec_header_reader_writer_unittest.cc",
@@ -466,6 +465,7 @@
"rtp_rtcp/source/rtp_sender_unittest.cc",
"rtp_rtcp/source/time_util_unittest.cc",
"rtp_rtcp/source/ulpfec_header_reader_writer_unittest.cc",
+ "rtp_rtcp/source/ulpfec_receiver_unittest.cc",
"rtp_rtcp/source/vp8_partition_aggregator_unittest.cc",
"rtp_rtcp/test/testAPI/test_api.cc",
"rtp_rtcp/test/testAPI/test_api.h",
diff --git a/webrtc/modules/rtp_rtcp/BUILD.gn b/webrtc/modules/rtp_rtcp/BUILD.gn
index af216e7..14b940a 100644
--- a/webrtc/modules/rtp_rtcp/BUILD.gn
+++ b/webrtc/modules/rtp_rtcp/BUILD.gn
@@ -10,7 +10,6 @@
rtc_static_library("rtp_rtcp") {
sources = [
- "include/fec_receiver.h",
"include/flexfec_receiver.h",
"include/receive_statistics.h",
"include/remote_ntp_time_estimator.h",
@@ -19,14 +18,13 @@
"include/rtp_receiver.h",
"include/rtp_rtcp.h",
"include/rtp_rtcp_defines.h",
+ "include/ulpfec_receiver.h",
"mocks/mock_rtp_rtcp.h",
"source/byte_io.h",
"source/dtmf_queue.cc",
"source/dtmf_queue.h",
"source/fec_private_tables_bursty.h",
"source/fec_private_tables_random.h",
- "source/fec_receiver_impl.cc",
- "source/fec_receiver_impl.h",
"source/flexfec_header_reader_writer.cc",
"source/flexfec_header_reader_writer.h",
"source/flexfec_receiver_impl.cc",
@@ -154,6 +152,8 @@
"source/tmmbr_help.h",
"source/ulpfec_header_reader_writer.cc",
"source/ulpfec_header_reader_writer.h",
+ "source/ulpfec_receiver_impl.cc",
+ "source/ulpfec_receiver_impl.h",
"source/video_codec_information.h",
"source/vp8_partition_aggregator.cc",
"source/vp8_partition_aggregator.h",
diff --git a/webrtc/modules/rtp_rtcp/include/flexfec_receiver.h b/webrtc/modules/rtp_rtcp/include/flexfec_receiver.h
index 8f672fc..fa1c853 100644
--- a/webrtc/modules/rtp_rtcp/include/flexfec_receiver.h
+++ b/webrtc/modules/rtp_rtcp/include/flexfec_receiver.h
@@ -14,7 +14,7 @@
#include <memory>
#include "webrtc/base/basictypes.h"
-#include "webrtc/modules/rtp_rtcp/include/fec_receiver.h"
+#include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h"
namespace webrtc {
diff --git a/webrtc/modules/rtp_rtcp/include/fec_receiver.h b/webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h
similarity index 82%
rename from webrtc/modules/rtp_rtcp/include/fec_receiver.h
rename to webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h
index debf2d7..fbb4b4c 100644
--- a/webrtc/modules/rtp_rtcp/include/fec_receiver.h
+++ b/webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h
@@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_FEC_RECEIVER_H_
-#define WEBRTC_MODULES_RTP_RTCP_INCLUDE_FEC_RECEIVER_H_
+#ifndef WEBRTC_MODULES_RTP_RTCP_INCLUDE_ULPFEC_RECEIVER_H_
+#define WEBRTC_MODULES_RTP_RTCP_INCLUDE_ULPFEC_RECEIVER_H_
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/typedefs.h"
@@ -18,20 +18,18 @@
struct FecPacketCounter {
FecPacketCounter()
- : num_packets(0),
- num_fec_packets(0),
- num_recovered_packets(0) {}
+ : num_packets(0), num_fec_packets(0), num_recovered_packets(0) {}
size_t num_packets; // Number of received packets.
size_t num_fec_packets; // Number of received FEC packets.
size_t num_recovered_packets; // Number of recovered media packets using FEC.
};
-class FecReceiver {
+class UlpfecReceiver {
public:
- static FecReceiver* Create(RtpData* callback);
+ static UlpfecReceiver* Create(RtpData* callback);
- virtual ~FecReceiver() {}
+ virtual ~UlpfecReceiver() {}
// Takes a RED packet, strips the RED header, and adds the resulting
// "virtual" RTP packet(s) into the internal buffer.
@@ -51,4 +49,4 @@
virtual FecPacketCounter GetPacketCounter() const = 0;
};
} // namespace webrtc
-#endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_FEC_RECEIVER_H_
+#endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_ULPFEC_RECEIVER_H_
diff --git a/webrtc/modules/rtp_rtcp/rtp_rtcp.gypi b/webrtc/modules/rtp_rtcp/rtp_rtcp.gypi
index 0be12fe..062f053 100644
--- a/webrtc/modules/rtp_rtcp/rtp_rtcp.gypi
+++ b/webrtc/modules/rtp_rtcp/rtp_rtcp.gypi
@@ -18,7 +18,6 @@
],
'sources': [
# Common
- 'include/fec_receiver.h',
'include/flexfec_receiver.h',
'include/receive_statistics.h',
'include/remote_ntp_time_estimator.h',
@@ -27,9 +26,8 @@
'include/rtp_receiver.h',
'include/rtp_rtcp.h',
'include/rtp_rtcp_defines.h',
+ 'include/ulpfec_receiver.h',
'source/byte_io.h',
- 'source/fec_receiver_impl.cc',
- 'source/fec_receiver_impl.h',
'source/flexfec_receiver_impl.cc',
'source/flexfec_receiver_impl.h',
'source/packet_loss_stats.cc',
@@ -163,6 +161,8 @@
'source/rtp_format_video_generic.h',
'source/ulpfec_header_reader_writer.cc',
'source/ulpfec_header_reader_writer.h',
+ 'source/ulpfec_receiver_impl.cc',
+ 'source/ulpfec_receiver_impl.h',
'source/vp8_partition_aggregator.cc',
'source/vp8_partition_aggregator.h',
# Mocks
diff --git a/webrtc/modules/rtp_rtcp/source/flexfec_receiver_impl.cc b/webrtc/modules/rtp_rtcp/source/flexfec_receiver_impl.cc
index e9dcd6f..bcd33ac 100644
--- a/webrtc/modules/rtp_rtcp/source/flexfec_receiver_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/flexfec_receiver_impl.cc
@@ -131,9 +131,9 @@
}
// Note that the implementation of this member function and the implementation
-// in FecReceiver::ProcessReceivedFec() are slightly different.
+// in UlpfecReceiver::ProcessReceivedFec() are slightly different.
// This implementation only returns _recovered_ media packets through the
-// callback, whereas the implementation in FecReceiver returns _all inserted_
+// callback, whereas the implementation in UlpfecReceiver returns _all inserted_
// media packets through the callback. The latter behaviour makes sense
// for ULPFEC, since the ULPFEC receiver is owned by the RtpStreamReceiver.
// Here, however, the received media pipeline is more decoupled from the
diff --git a/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc b/webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc
similarity index 92%
rename from webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc
rename to webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc
index c84ca5c..8ba53b5 100644
--- a/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/modules/rtp_rtcp/source/fec_receiver_impl.h"
+#include "webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.h"
#include <memory>
#include <utility>
@@ -20,20 +20,20 @@
namespace webrtc {
-FecReceiver* FecReceiver::Create(RtpData* callback) {
- return new FecReceiverImpl(callback);
+UlpfecReceiver* UlpfecReceiver::Create(RtpData* callback) {
+ return new UlpfecReceiverImpl(callback);
}
-FecReceiverImpl::FecReceiverImpl(RtpData* callback)
+UlpfecReceiverImpl::UlpfecReceiverImpl(RtpData* callback)
: recovered_packet_callback_(callback),
fec_(ForwardErrorCorrection::CreateUlpfec()) {}
-FecReceiverImpl::~FecReceiverImpl() {
+UlpfecReceiverImpl::~UlpfecReceiverImpl() {
received_packets_.clear();
fec_->ResetState(&recovered_packets_);
}
-FecPacketCounter FecReceiverImpl::GetPacketCounter() const {
+FecPacketCounter UlpfecReceiverImpl::GetPacketCounter() const {
rtc::CritScope cs(&crit_sect_);
return packet_counter_;
}
@@ -66,9 +66,11 @@
// block length: 10 bits Length in bytes of the corresponding data
// block excluding header.
-int32_t FecReceiverImpl::AddReceivedRedPacket(
- const RTPHeader& header, const uint8_t* incoming_rtp_packet,
- size_t packet_length, uint8_t ulpfec_payload_type) {
+int32_t UlpfecReceiverImpl::AddReceivedRedPacket(
+ const RTPHeader& header,
+ const uint8_t* incoming_rtp_packet,
+ size_t packet_length,
+ uint8_t ulpfec_payload_type) {
rtc::CritScope cs(&crit_sect_);
uint8_t red_header_length = 1;
@@ -100,8 +102,7 @@
uint16_t timestamp_offset = incoming_rtp_packet[header.headerLength + 1]
<< 8;
- timestamp_offset +=
- incoming_rtp_packet[header.headerLength + 2];
+ timestamp_offset += incoming_rtp_packet[header.headerLength + 2];
timestamp_offset = timestamp_offset >> 2;
if (timestamp_offset != 0) {
LOG(LS_WARNING) << "Corrupt payload found.";
@@ -199,7 +200,7 @@
return 0;
}
-int32_t FecReceiverImpl::ProcessReceivedFec() {
+int32_t UlpfecReceiverImpl::ProcessReceivedFec() {
crit_sect_.Enter();
if (!received_packets_.empty()) {
// Send received media packet to VCM.
diff --git a/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.h b/webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.h
similarity index 79%
rename from webrtc/modules/rtp_rtcp/source/fec_receiver_impl.h
rename to webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.h
index bd3a79d..8dbc8af 100644
--- a/webrtc/modules/rtp_rtcp/source/fec_receiver_impl.h
+++ b/webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.h
@@ -8,23 +8,23 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_RECEIVER_IMPL_H_
-#define WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_RECEIVER_IMPL_H_
+#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_
+#define WEBRTC_MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_
#include <memory>
#include "webrtc/base/criticalsection.h"
-#include "webrtc/modules/rtp_rtcp/include/fec_receiver.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
+#include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h"
#include "webrtc/modules/rtp_rtcp/source/forward_error_correction.h"
#include "webrtc/typedefs.h"
namespace webrtc {
-class FecReceiverImpl : public FecReceiver {
+class UlpfecReceiverImpl : public UlpfecReceiver {
public:
- explicit FecReceiverImpl(RtpData* callback);
- virtual ~FecReceiverImpl();
+ explicit UlpfecReceiverImpl(RtpData* callback);
+ virtual ~UlpfecReceiverImpl();
int32_t AddReceivedRedPacket(const RTPHeader& rtp_header,
const uint8_t* incoming_rtp_packet,
@@ -49,4 +49,4 @@
} // namespace webrtc
-#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_FEC_RECEIVER_IMPL_H_
+#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_ULPFEC_RECEIVER_IMPL_H_
diff --git a/webrtc/modules/rtp_rtcp/source/fec_receiver_unittest.cc b/webrtc/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc
similarity index 73%
rename from webrtc/modules/rtp_rtcp/source/fec_receiver_unittest.cc
rename to webrtc/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc
index 0c4b486..89e91c4 100644
--- a/webrtc/modules/rtp_rtcp/source/fec_receiver_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/ulpfec_receiver_unittest.cc
@@ -13,8 +13,8 @@
#include <list>
#include <memory>
-#include "webrtc/modules/rtp_rtcp/include/fec_receiver.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
+#include "webrtc/modules/rtp_rtcp/include/ulpfec_receiver.h"
#include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/modules/rtp_rtcp/source/fec_test_helper.h"
@@ -38,11 +38,11 @@
constexpr uint32_t kMediaSsrc = 835424;
} // namespace
-class ReceiverFecTest : public ::testing::Test {
+class UlpfecReceiverTest : public ::testing::Test {
protected:
- ReceiverFecTest()
+ UlpfecReceiverTest()
: fec_(ForwardErrorCorrection::CreateUlpfec()),
- receiver_fec_(FecReceiver::Create(&rtp_data_callback_)),
+ receiver_fec_(UlpfecReceiver::Create(&rtp_data_callback_)),
packet_generator_(kMediaSsrc) {}
// Generates |num_fec_packets| FEC packets, given |media_packets|.
@@ -77,11 +77,11 @@
MockRtpData rtp_data_callback_;
std::unique_ptr<ForwardErrorCorrection> fec_;
- std::unique_ptr<FecReceiver> receiver_fec_;
+ std::unique_ptr<UlpfecReceiver> receiver_fec_;
UlpfecPacketGenerator packet_generator_;
};
-void ReceiverFecTest::EncodeFec(
+void UlpfecReceiverTest::EncodeFec(
const ForwardErrorCorrection::PacketList& media_packets,
size_t num_fec_packets,
std::list<ForwardErrorCorrection::Packet*>* fec_packets) {
@@ -98,7 +98,7 @@
ASSERT_EQ(num_fec_packets, fec_packets->size());
}
-void ReceiverFecTest::PacketizeFrame(
+void UlpfecReceiverTest::PacketizeFrame(
size_t num_media_packets,
size_t frame_offset,
std::list<AugmentedPacket*>* augmented_packets,
@@ -112,7 +112,7 @@
}
}
-void ReceiverFecTest::BuildAndAddRedMediaPacket(AugmentedPacket* packet) {
+void UlpfecReceiverTest::BuildAndAddRedMediaPacket(AugmentedPacket* packet) {
std::unique_ptr<AugmentedPacket> red_packet(
packet_generator_.BuildMediaRedPacket(*packet));
EXPECT_EQ(0, receiver_fec_->AddReceivedRedPacket(
@@ -120,7 +120,7 @@
red_packet->length, kFecPayloadType));
}
-void ReceiverFecTest::BuildAndAddRedFecPacket(Packet* packet) {
+void UlpfecReceiverTest::BuildAndAddRedFecPacket(Packet* packet) {
std::unique_ptr<AugmentedPacket> red_packet(
packet_generator_.BuildUlpfecRedPacket(*packet));
EXPECT_EQ(0, receiver_fec_->AddReceivedRedPacket(
@@ -128,7 +128,7 @@
red_packet->length, kFecPayloadType));
}
-void ReceiverFecTest::VerifyReconstructedMediaPacket(
+void UlpfecReceiverTest::VerifyReconstructedMediaPacket(
const AugmentedPacket& packet,
size_t times) {
// Verify that the content of the reconstructed packet is equal to the
@@ -140,7 +140,7 @@
.WillRepeatedly(Return(true));
}
-void ReceiverFecTest::InjectGarbagePacketLength(size_t fec_garbage_offset) {
+void UlpfecReceiverTest::InjectGarbagePacketLength(size_t fec_garbage_offset) {
EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
.WillRepeatedly(Return(true));
@@ -165,22 +165,21 @@
EXPECT_EQ(0U, counter.num_recovered_packets);
}
-void ReceiverFecTest::SurvivesMaliciousPacket(const uint8_t* data,
- size_t length,
- uint8_t ulpfec_payload_type) {
- webrtc::RTPHeader header;
- std::unique_ptr<webrtc::RtpHeaderParser> parser(
- webrtc::RtpHeaderParser::Create());
+void UlpfecReceiverTest::SurvivesMaliciousPacket(const uint8_t* data,
+ size_t length,
+ uint8_t ulpfec_payload_type) {
+ RTPHeader header;
+ std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
ASSERT_TRUE(parser->Parse(data, length, &header));
- webrtc::NullRtpData null_callback;
- std::unique_ptr<webrtc::FecReceiver> receiver_fec(
- webrtc::FecReceiver::Create(&null_callback));
+ NullRtpData null_callback;
+ std::unique_ptr<UlpfecReceiver> receiver_fec(
+ UlpfecReceiver::Create(&null_callback));
receiver_fec->AddReceivedRedPacket(header, data, length, ulpfec_payload_type);
}
-TEST_F(ReceiverFecTest, TwoMediaOneFec) {
+TEST_F(UlpfecReceiverTest, TwoMediaOneFec) {
constexpr size_t kNumFecPackets = 1u;
std::list<AugmentedPacket*> augmented_media_packets;
ForwardErrorCorrection::PacketList media_packets;
@@ -206,18 +205,18 @@
EXPECT_EQ(1u, counter.num_recovered_packets);
}
-TEST_F(ReceiverFecTest, InjectGarbageFecHeaderLengthRecovery) {
+TEST_F(UlpfecReceiverTest, InjectGarbageFecHeaderLengthRecovery) {
// Byte offset 8 is the 'length recovery' field of the FEC header.
InjectGarbagePacketLength(8);
}
-TEST_F(ReceiverFecTest, InjectGarbageFecLevelHeaderProtectionLength) {
+TEST_F(UlpfecReceiverTest, InjectGarbageFecLevelHeaderProtectionLength) {
// Byte offset 10 is the 'protection length' field in the first FEC level
// header.
InjectGarbagePacketLength(10);
}
-TEST_F(ReceiverFecTest, TwoMediaTwoFec) {
+TEST_F(UlpfecReceiverTest, TwoMediaTwoFec) {
const size_t kNumFecPackets = 2;
std::list<AugmentedPacket*> augmented_media_packets;
ForwardErrorCorrection::PacketList media_packets;
@@ -239,7 +238,7 @@
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
-TEST_F(ReceiverFecTest, TwoFramesOneFec) {
+TEST_F(UlpfecReceiverTest, TwoFramesOneFec) {
const size_t kNumFecPackets = 1;
std::list<AugmentedPacket*> augmented_media_packets;
ForwardErrorCorrection::PacketList media_packets;
@@ -260,7 +259,7 @@
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
-TEST_F(ReceiverFecTest, OneCompleteOneUnrecoverableFrame) {
+TEST_F(UlpfecReceiverTest, OneCompleteOneUnrecoverableFrame) {
const size_t kNumFecPackets = 1;
std::list<AugmentedPacket*> augmented_media_packets;
ForwardErrorCorrection::PacketList media_packets;
@@ -281,7 +280,7 @@
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
-TEST_F(ReceiverFecTest, MaxFramesOneFec) {
+TEST_F(UlpfecReceiverTest, MaxFramesOneFec) {
const size_t kNumFecPackets = 1;
const size_t kNumMediaPackets = 48;
std::list<AugmentedPacket*> augmented_media_packets;
@@ -306,7 +305,7 @@
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
-TEST_F(ReceiverFecTest, TooManyFrames) {
+TEST_F(UlpfecReceiverTest, TooManyFrames) {
const size_t kNumFecPackets = 1;
const size_t kNumMediaPackets = 49;
std::list<AugmentedPacket*> augmented_media_packets;
@@ -320,7 +319,7 @@
false, kFecMaskBursty, &fec_packets));
}
-TEST_F(ReceiverFecTest, PacketNotDroppedTooEarly) {
+TEST_F(UlpfecReceiverTest, PacketNotDroppedTooEarly) {
// 1 frame with 2 media packets and one FEC packet. One media packet missing.
// Delay the FEC packet.
Packet* delayed_fec = nullptr;
@@ -335,7 +334,8 @@
BuildAndAddRedMediaPacket(augmented_media_packets_batch1.front());
EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(1).WillRepeatedly(Return(true));
+ .Times(1)
+ .WillRepeatedly(Return(true));
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
delayed_fec = fec_packets.front();
@@ -351,18 +351,20 @@
it != augmented_media_packets_batch2.end(); ++it) {
BuildAndAddRedMediaPacket(*it);
EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(1).WillRepeatedly(Return(true));
+ .Times(1)
+ .WillRepeatedly(Return(true));
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
// Add the delayed FEC packet. One packet should be reconstructed.
BuildAndAddRedFecPacket(delayed_fec);
EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(1).WillRepeatedly(Return(true));
+ .Times(1)
+ .WillRepeatedly(Return(true));
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
-TEST_F(ReceiverFecTest, PacketDroppedWhenTooOld) {
+TEST_F(UlpfecReceiverTest, PacketDroppedWhenTooOld) {
// 1 frame with 2 media packets and one FEC packet. One media packet missing.
// Delay the FEC packet.
Packet* delayed_fec = nullptr;
@@ -377,7 +379,8 @@
BuildAndAddRedMediaPacket(augmented_media_packets_batch1.front());
EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(1).WillRepeatedly(Return(true));
+ .Times(1)
+ .WillRepeatedly(Return(true));
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
delayed_fec = fec_packets.front();
@@ -393,19 +396,19 @@
it != augmented_media_packets_batch2.end(); ++it) {
BuildAndAddRedMediaPacket(*it);
EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(1).WillRepeatedly(Return(true));
+ .Times(1)
+ .WillRepeatedly(Return(true));
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
// Add the delayed FEC packet. No packet should be reconstructed since the
// first media packet of that frame has been dropped due to being too old.
BuildAndAddRedFecPacket(delayed_fec);
- EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(0);
+ EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _)).Times(0);
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
-TEST_F(ReceiverFecTest, OldFecPacketDropped) {
+TEST_F(UlpfecReceiverTest, OldFecPacketDropped) {
// 49 frames with 2 media packets and one FEC packet. All media packets
// missing.
const size_t kNumMediaPackets = 49 * 2;
@@ -420,8 +423,7 @@
for (auto it = fec_packets.begin(); it != fec_packets.end(); ++it) {
// Only FEC packets inserted. No packets recoverable at this time.
BuildAndAddRedFecPacket(*it);
- EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(0);
+ EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _)).Times(0);
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
// Move unique_ptr's to media_packets for lifetime management.
@@ -437,120 +439,34 @@
// returned.
BuildAndAddRedMediaPacket(augmented_media_packets.front());
EXPECT_CALL(rtp_data_callback_, OnRecoveredPacket(_, _))
- .Times(1).WillRepeatedly(Return(true));
+ .Times(1)
+ .WillRepeatedly(Return(true));
EXPECT_EQ(0, receiver_fec_->ProcessReceivedFec());
}
-TEST_F(ReceiverFecTest, TruncatedPacketWithFBitSet) {
- const uint8_t kTruncatedPacket[] = {0x80,
- 0x2a,
- 0x68,
- 0x71,
- 0x29,
- 0xa1,
- 0x27,
- 0x3a,
- 0x29,
- 0x12,
- 0x2a,
- 0x98,
- 0xe0,
- 0x29};
+TEST_F(UlpfecReceiverTest, TruncatedPacketWithFBitSet) {
+ const uint8_t kTruncatedPacket[] = {0x80, 0x2a, 0x68, 0x71, 0x29, 0xa1, 0x27,
+ 0x3a, 0x29, 0x12, 0x2a, 0x98, 0xe0, 0x29};
SurvivesMaliciousPacket(kTruncatedPacket, sizeof(kTruncatedPacket), 100);
}
-TEST_F(ReceiverFecTest, TruncatedPacketWithFBitSetEndingAfterFirstRedHeader) {
- const uint8_t kPacket[] = {0x89,
- 0x27,
- 0x3a,
- 0x83,
- 0x27,
- 0x3a,
- 0x3a,
- 0xf3,
- 0x67,
- 0xbe,
- 0x2a,
- 0xa9,
- 0x27,
- 0x54,
- 0x3a,
- 0x3a,
- 0x2a,
- 0x67,
- 0x3a,
- 0xf3,
- 0x67,
- 0xbe,
- 0x2a,
- 0x27,
- 0xe6,
- 0xf6,
- 0x03,
- 0x3e,
- 0x29,
- 0x27,
- 0x21,
- 0x27,
- 0x2a,
- 0x29,
- 0x21,
- 0x4b,
- 0x29,
- 0x3a,
- 0x28,
- 0x29,
- 0xbf,
- 0x29,
- 0x2a,
- 0x26,
- 0x29,
- 0xae,
- 0x27,
- 0xa6,
- 0xf6,
- 0x00,
- 0x03,
- 0x3e};
+TEST_F(UlpfecReceiverTest,
+ TruncatedPacketWithFBitSetEndingAfterFirstRedHeader) {
+ const uint8_t kPacket[] = {
+ 0x89, 0x27, 0x3a, 0x83, 0x27, 0x3a, 0x3a, 0xf3, 0x67, 0xbe, 0x2a,
+ 0xa9, 0x27, 0x54, 0x3a, 0x3a, 0x2a, 0x67, 0x3a, 0xf3, 0x67, 0xbe,
+ 0x2a, 0x27, 0xe6, 0xf6, 0x03, 0x3e, 0x29, 0x27, 0x21, 0x27, 0x2a,
+ 0x29, 0x21, 0x4b, 0x29, 0x3a, 0x28, 0x29, 0xbf, 0x29, 0x2a, 0x26,
+ 0x29, 0xae, 0x27, 0xa6, 0xf6, 0x00, 0x03, 0x3e};
SurvivesMaliciousPacket(kPacket, sizeof(kPacket), 100);
}
-TEST_F(ReceiverFecTest, TruncatedPacketWithoutDataPastFirstBlock) {
- const uint8_t kPacket[] = {0x82,
- 0x38,
- 0x92,
- 0x38,
- 0x92,
- 0x38,
- 0xde,
- 0x2a,
- 0x11,
- 0xc8,
- 0xa3,
- 0xc4,
- 0x82,
- 0x38,
- 0x2a,
- 0x21,
- 0x2a,
- 0x28,
- 0x92,
- 0x38,
- 0x92,
- 0x00,
- 0x00,
- 0x0a,
- 0x3a,
- 0xc8,
- 0xa3,
- 0x3a,
- 0x27,
- 0xc4,
- 0x2a,
- 0x21,
- 0x2a,
- 0x28};
+TEST_F(UlpfecReceiverTest, TruncatedPacketWithoutDataPastFirstBlock) {
+ const uint8_t kPacket[] = {
+ 0x82, 0x38, 0x92, 0x38, 0x92, 0x38, 0xde, 0x2a, 0x11, 0xc8, 0xa3, 0xc4,
+ 0x82, 0x38, 0x2a, 0x21, 0x2a, 0x28, 0x92, 0x38, 0x92, 0x00, 0x00, 0x0a,
+ 0x3a, 0xc8, 0xa3, 0x3a, 0x27, 0xc4, 0x2a, 0x21, 0x2a, 0x28};
SurvivesMaliciousPacket(kPacket, sizeof(kPacket), 100);
}