| Index: webrtc/modules/video_coding/frame_buffer2_unittest.cc
|
| diff --git a/webrtc/modules/video_coding/frame_buffer2_unittest.cc b/webrtc/modules/video_coding/frame_buffer2_unittest.cc
|
| index ad776df310b85c8404512fbb2a0250f71efa6a78..46cccad1d63249af2fb54fa8fa4ae44afc942f41 100644
|
| --- a/webrtc/modules/video_coding/frame_buffer2_unittest.cc
|
| +++ b/webrtc/modules/video_coding/frame_buffer2_unittest.cc
|
| @@ -111,11 +111,11 @@ class TestFrameBuffer2 : public ::testing::Test {
|
| }
|
|
|
| template <typename... T>
|
| - void InsertFrame(uint16_t picture_id,
|
| - uint8_t spatial_layer,
|
| - int64_t ts_ms,
|
| - bool inter_layer_predicted,
|
| - T... refs) {
|
| + int InsertFrame(uint16_t picture_id,
|
| + uint8_t spatial_layer,
|
| + int64_t ts_ms,
|
| + bool inter_layer_predicted,
|
| + T... refs) {
|
| static_assert(sizeof...(refs) <= kMaxReferences,
|
| "To many references specified for FrameObject.");
|
| std::array<uint16_t, sizeof...(refs)> references = {{refs...}};
|
| @@ -129,7 +129,7 @@ class TestFrameBuffer2 : public ::testing::Test {
|
| for (size_t r = 0; r < references.size(); ++r)
|
| frame->references[r] = references[r];
|
|
|
| - buffer_.InsertFrame(std::move(frame));
|
| + return buffer_.InsertFrame(std::move(frame));
|
| }
|
|
|
| void ExtractFrame(int64_t max_wait_time = 0) {
|
| @@ -216,6 +216,19 @@ TEST_F(TestFrameBuffer2, OneSuperFrame) {
|
| uint16_t pid = Rand();
|
| uint32_t ts = Rand();
|
|
|
| + InsertFrame(pid, 0, ts, false);
|
| + ExtractFrame();
|
| + InsertFrame(pid, 1, ts, true);
|
| + ExtractFrame();
|
| +
|
| + CheckFrame(0, pid, 0);
|
| + CheckFrame(1, pid, 1);
|
| +}
|
| +
|
| +TEST_F(TestFrameBuffer2, OneUnorderedSuperFrame) {
|
| + uint16_t pid = Rand();
|
| + uint32_t ts = Rand();
|
| +
|
| ExtractFrame(50);
|
| InsertFrame(pid, 1, ts, true);
|
| InsertFrame(pid, 0, ts, false);
|
| @@ -358,5 +371,37 @@ TEST_F(TestFrameBuffer2, ProtectionMode) {
|
| ExtractFrame();
|
| }
|
|
|
| +TEST_F(TestFrameBuffer2, NoContinuousFrame) {
|
| + uint16_t pid = Rand();
|
| + uint32_t ts = Rand();
|
| +
|
| + EXPECT_EQ(-1, InsertFrame(pid + 1, 0, ts, false, pid));
|
| +}
|
| +
|
| +TEST_F(TestFrameBuffer2, LastContinuousFrameSingleLayer) {
|
| + uint16_t pid = Rand();
|
| + uint32_t ts = Rand();
|
| +
|
| + EXPECT_EQ(pid, InsertFrame(pid, 0, ts, false));
|
| + EXPECT_EQ(pid, InsertFrame(pid + 2, 0, ts, false, pid + 1));
|
| + EXPECT_EQ(pid + 2, InsertFrame(pid + 1, 0, ts, false, pid));
|
| + EXPECT_EQ(pid + 2, InsertFrame(pid + 4, 0, ts, false, pid + 3));
|
| + EXPECT_EQ(pid + 5, InsertFrame(pid + 5, 0, ts, false));
|
| +}
|
| +
|
| +TEST_F(TestFrameBuffer2, LastContinuousFrameTwoLayers) {
|
| + uint16_t pid = Rand();
|
| + uint32_t ts = Rand();
|
| +
|
| + EXPECT_EQ(pid, InsertFrame(pid, 0, ts, false));
|
| + EXPECT_EQ(pid, InsertFrame(pid, 1, ts, true));
|
| + EXPECT_EQ(pid, InsertFrame(pid + 1, 1, ts, true, pid));
|
| + EXPECT_EQ(pid, InsertFrame(pid + 2, 0, ts, false, pid + 1));
|
| + EXPECT_EQ(pid, InsertFrame(pid + 2, 1, ts, true, pid + 1));
|
| + EXPECT_EQ(pid, InsertFrame(pid + 3, 0, ts, false, pid + 2));
|
| + EXPECT_EQ(pid + 3, InsertFrame(pid + 1, 0, ts, false, pid));
|
| + EXPECT_EQ(pid + 3, InsertFrame(pid + 3, 1, ts, true, pid + 2));
|
| +}
|
| +
|
| } // namespace video_coding
|
| } // namespace webrtc
|
|
|