Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: media/cast/transport/rtp_sender/packet_storage/packet_storage_unittest.cc

Issue 248493002: Cast: Deduplicate packets in paced sender and always send older packets first (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-upping to trick build system Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/cast/transport/rtp_sender/packet_storage/packet_storage_unittest.cc
diff --git a/media/cast/transport/rtp_sender/packet_storage/packet_storage_unittest.cc b/media/cast/transport/rtp_sender/packet_storage/packet_storage_unittest.cc
index b6953493dd969ed958f2dbbcae5e43492be6bc3a..ae046f5f41dd8d1768f3a1a6604b0fbf8fa04675 100644
--- a/media/cast/transport/rtp_sender/packet_storage/packet_storage_unittest.cc
+++ b/media/cast/transport/rtp_sender/packet_storage/packet_storage_unittest.cc
@@ -37,11 +37,15 @@ class PacketStorageTest : public ::testing::Test {
TEST_F(PacketStorageTest, TimeOut) {
Packet test_123(100, 123); // 100 insertions of the value 123.
- PacketList packets;
+ SendPacketVector packets;
for (uint32 frame_id = 0; frame_id < 30; ++frame_id) {
+ base::TimeTicks frame_tick = testing_clock_.NowTicks();
for (uint16 packet_id = 0; packet_id < 10; ++packet_id) {
packet_storage_.StorePacket(frame_id,
packet_id,
+ PacedPacketSender::MakePacketKey(frame_tick,
+ 1, // ssrc
+ packet_id),
new base::RefCountedData<Packet>(test_123));
}
testing_clock_.Advance(kDeltaBetweenFrames);
@@ -58,48 +62,58 @@ TEST_F(PacketStorageTest, TimeOut) {
for (uint32 frame_id = 14; frame_id < 30; ++frame_id) {
for (uint16 packet_id = 0; packet_id < 10; ++packet_id) {
EXPECT_TRUE(packet_storage_.GetPacket(frame_id, packet_id, &packets));
- EXPECT_TRUE(packets.front()->data == test_123);
+ EXPECT_TRUE(packets.front().second->data == test_123);
}
}
}
TEST_F(PacketStorageTest, MaxNumberOfPackets) {
Packet test_123(100, 123); // 100 insertions of the value 123.
- PacketList packets;
+ SendPacketVector packets;
uint32 frame_id = 0;
+ base::TimeTicks frame_tick = testing_clock_.NowTicks();
for (uint16 packet_id = 0; packet_id <= PacketStorage::kMaxStoredPackets;
++packet_id) {
packet_storage_.StorePacket(frame_id,
packet_id,
+ PacedPacketSender::MakePacketKey(frame_tick,
+ 1, // ssrc
+ packet_id),
new base::RefCountedData<Packet>(test_123));
}
- Packet packet;
uint16 packet_id = 0;
EXPECT_FALSE(packet_storage_.GetPacket(frame_id, packet_id, &packets));
++packet_id;
for (; packet_id <= PacketStorage::kMaxStoredPackets; ++packet_id) {
EXPECT_TRUE(packet_storage_.GetPacket(frame_id, packet_id, &packets));
- EXPECT_TRUE(packets.back()->data == test_123);
+ EXPECT_TRUE(packets.back().second->data == test_123);
}
}
TEST_F(PacketStorageTest, PacketContent) {
Packet test_123(100, 123); // 100 insertions of the value 123.
Packet test_234(200, 234); // 200 insertions of the value 234.
- PacketList packets;
+ SendPacketVector packets;
for (uint32 frame_id = 0; frame_id < 10; ++frame_id) {
+ base::TimeTicks frame_tick = testing_clock_.NowTicks();
for (uint16 packet_id = 0; packet_id < 10; ++packet_id) {
// Every other packet.
if (packet_id % 2 == 0) {
packet_storage_.StorePacket(frame_id,
packet_id,
+ PacedPacketSender::MakePacketKey(frame_tick,
+ 1, // ssrc
+ packet_id),
new base::RefCountedData<Packet>(test_123));
} else {
packet_storage_.StorePacket(frame_id,
packet_id,
+ PacedPacketSender::MakePacketKey(frame_tick,
+ 1, // ssrc
+ packet_id),
new base::RefCountedData<Packet>(test_234));
}
}
@@ -110,9 +124,9 @@ TEST_F(PacketStorageTest, PacketContent) {
EXPECT_TRUE(packet_storage_.GetPacket(frame_id, packet_id, &packets));
// Every other packet.
if (packet_id % 2 == 0) {
- EXPECT_TRUE(packets.back()->data == test_123);
+ EXPECT_TRUE(packets.back().second->data == test_123);
} else {
- EXPECT_TRUE(packets.back()->data == test_234);
+ EXPECT_TRUE(packets.back().second->data == test_234);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698