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

Side by Side Diff: webrtc/modules/video_coding/frame_buffer2_unittest.cc

Issue 2995153002: Revert of quest keyframes more frequently on stream start/decoding error. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 frame->spatial_layer = spatial_layer; 160 frame->spatial_layer = spatial_layer;
161 frame->timestamp = ts_ms * 90; 161 frame->timestamp = ts_ms * 90;
162 frame->num_references = references.size(); 162 frame->num_references = references.size();
163 frame->inter_layer_predicted = inter_layer_predicted; 163 frame->inter_layer_predicted = inter_layer_predicted;
164 for (size_t r = 0; r < references.size(); ++r) 164 for (size_t r = 0; r < references.size(); ++r)
165 frame->references[r] = references[r]; 165 frame->references[r] = references[r];
166 166
167 return buffer_.InsertFrame(std::move(frame)); 167 return buffer_.InsertFrame(std::move(frame));
168 } 168 }
169 169
170 void ExtractFrame(int64_t max_wait_time = 0, bool keyframe_required = false) { 170 void ExtractFrame(int64_t max_wait_time = 0) {
171 crit_.Enter(); 171 crit_.Enter();
172 if (max_wait_time == 0) { 172 if (max_wait_time == 0) {
173 std::unique_ptr<FrameObject> frame; 173 std::unique_ptr<FrameObject> frame;
174 FrameBuffer::ReturnReason res = 174 FrameBuffer::ReturnReason res = buffer_.NextFrame(0, &frame);
175 buffer_.NextFrame(0, &frame, keyframe_required);
176 if (res != FrameBuffer::ReturnReason::kStopped) 175 if (res != FrameBuffer::ReturnReason::kStopped)
177 frames_.emplace_back(std::move(frame)); 176 frames_.emplace_back(std::move(frame));
178 crit_.Leave(); 177 crit_.Leave();
179 } else { 178 } else {
180 max_wait_time_ = max_wait_time; 179 max_wait_time_ = max_wait_time;
181 trigger_extract_event_.Set(); 180 trigger_extract_event_.Set();
182 crit_.Leave(); 181 crit_.Leave();
183 // Make sure |crit_| is aquired by |extract_thread_| before returning. 182 // Make sure |crit_| is aquired by |extract_thread_| before returning.
184 crit_acquired_event_.Wait(rtc::Event::kForever); 183 crit_acquired_event_.Wait(rtc::Event::kForever);
185 } 184 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 } 533 }
535 534
536 // TODO(philipel): implement more unittests related to invalid references. 535 // TODO(philipel): implement more unittests related to invalid references.
537 TEST_F(TestFrameBuffer2, InvalidReferences) { 536 TEST_F(TestFrameBuffer2, InvalidReferences) {
538 EXPECT_EQ(-1, InsertFrame(0, 0, 1000, false, 2)); 537 EXPECT_EQ(-1, InsertFrame(0, 0, 1000, false, 2));
539 EXPECT_EQ(1, InsertFrame(1, 0, 2000, false)); 538 EXPECT_EQ(1, InsertFrame(1, 0, 2000, false));
540 ExtractFrame(); 539 ExtractFrame();
541 EXPECT_EQ(2, InsertFrame(2, 0, 3000, false, 1)); 540 EXPECT_EQ(2, InsertFrame(2, 0, 3000, false, 1));
542 } 541 }
543 542
544 TEST_F(TestFrameBuffer2, KeyframeRequired) {
545 EXPECT_EQ(1, InsertFrame(1, 0, 1000, false));
546 EXPECT_EQ(2, InsertFrame(2, 0, 2000, false, 1));
547 EXPECT_EQ(3, InsertFrame(3, 0, 3000, false));
548 ExtractFrame();
549 ExtractFrame(0, true);
550 ExtractFrame();
551
552 CheckFrame(0, 1, 0);
553 CheckFrame(1, 3, 0);
554 CheckNoFrame(2);
555 }
556
557 } // namespace video_coding 543 } // namespace video_coding
558 } // namespace webrtc 544 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/frame_buffer2.cc ('k') | webrtc/modules/video_coding/frame_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698