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

Unified Diff: webrtc/modules/video_coding/frame_buffer2_unittest.cc

Issue 2996823002: Reland of quest keyframes more frequently on stream start/decoding error. (Closed)
Patch Set: Fix Created 3 years, 4 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: 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 d85f1cf2334c1ba4f66f576bc668500085a077dc..95a879b36d554fe8586447769e00c5fe77174558 100644
--- a/webrtc/modules/video_coding/frame_buffer2_unittest.cc
+++ b/webrtc/modules/video_coding/frame_buffer2_unittest.cc
@@ -167,11 +167,12 @@ class TestFrameBuffer2 : public ::testing::Test {
return buffer_.InsertFrame(std::move(frame));
}
- void ExtractFrame(int64_t max_wait_time = 0) {
+ void ExtractFrame(int64_t max_wait_time = 0, bool keyframe_required = false) {
crit_.Enter();
if (max_wait_time == 0) {
std::unique_ptr<FrameObject> frame;
- FrameBuffer::ReturnReason res = buffer_.NextFrame(0, &frame);
+ FrameBuffer::ReturnReason res =
+ buffer_.NextFrame(0, &frame, keyframe_required);
if (res != FrameBuffer::ReturnReason::kStopped)
frames_.emplace_back(std::move(frame));
crit_.Leave();
@@ -540,5 +541,18 @@ TEST_F(TestFrameBuffer2, InvalidReferences) {
EXPECT_EQ(2, InsertFrame(2, 0, 3000, false, 1));
}
+TEST_F(TestFrameBuffer2, KeyframeRequired) {
+ EXPECT_EQ(1, InsertFrame(1, 0, 1000, false));
+ EXPECT_EQ(2, InsertFrame(2, 0, 2000, false, 1));
+ EXPECT_EQ(3, InsertFrame(3, 0, 3000, false));
+ ExtractFrame();
+ ExtractFrame(0, true);
+ ExtractFrame();
+
+ CheckFrame(0, 1, 0);
+ CheckFrame(1, 3, 0);
+ CheckNoFrame(2);
+}
+
} // namespace video_coding
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698