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..17c2274db4a5e09097b1296bd44eb5a0d595d9db 100644 |
--- a/webrtc/modules/video_coding/frame_buffer2_unittest.cc |
+++ b/webrtc/modules/video_coding/frame_buffer2_unittest.cc |
@@ -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)); |
+ last_continuous_frames_.push_back(buffer_.InsertFrame(std::move(frame))); |
} |
void ExtractFrame(int64_t max_wait_time = 0) { |
@@ -157,6 +157,12 @@ class TestFrameBuffer2 : public ::testing::Test { |
ASSERT_EQ(spatial_layer, frames_[index]->spatial_layer); |
} |
+ void CheckLastContinuousFrame(size_t index, int picture_id) { |
+ rtc::CritScope lock(&crit_); |
+ ASSERT_LT(index, last_continuous_frames_.size()); |
+ ASSERT_EQ(picture_id, last_continuous_frames_[index]); |
+ } |
+ |
void CheckNoFrame(size_t index) { |
rtc::CritScope lock(&crit_); |
ASSERT_LT(index, frames_.size()); |
@@ -189,6 +195,7 @@ class TestFrameBuffer2 : public ::testing::Test { |
::testing::NiceMock<VCMJitterEstimatorMock> jitter_estimator_; |
FrameBuffer buffer_; |
std::vector<std::unique_ptr<FrameObject>> frames_; |
+ std::vector<int> last_continuous_frames_; |
Random rand_; |
int64_t max_wait_time_; |
@@ -358,5 +365,22 @@ TEST_F(TestFrameBuffer2, ProtectionMode) { |
ExtractFrame(); |
} |
+TEST_F(TestFrameBuffer2, LastContinuousFrameSingleStream) { |
danilchap
2016/09/12 12:20:14
It helps when test name describes both scenario an
|
+ uint16_t pid = Rand(); |
+ uint32_t ts = Rand(); |
+ |
+ InsertFrame(pid, 0, ts, false); |
+ InsertFrame(pid + 2, 0, ts, false, pid + 1); |
+ InsertFrame(pid + 1, 0, ts, false, pid); |
+ InsertFrame(pid + 4, 0, ts, false, pid + 3); |
+ InsertFrame(pid + 5, 0, ts, false); |
+ |
+ CheckLastContinuousFrame(0, pid); |
danilchap
2016/09/12 12:20:14
May be make InsertFrame return the result of buffe
philipel
2016/09/16 14:01:20
Done.
|
+ CheckLastContinuousFrame(1, pid); |
+ CheckLastContinuousFrame(2, pid + 2); |
+ CheckLastContinuousFrame(3, pid + 2); |
+ CheckLastContinuousFrame(4, pid + 5); |
+} |
danilchap
2016/09/12 12:20:14
May be add a test case where InsertFrame return -1
philipel
2016/09/16 14:01:20
Done.
|
+ |
} // namespace video_coding |
} // namespace webrtc |