OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ScreenshareLayerTest() | 51 ScreenshareLayerTest() |
52 : min_qp_(2), max_qp_(kDefaultQp), frame_size_(-1), clock_(1) {} | 52 : min_qp_(2), max_qp_(kDefaultQp), frame_size_(-1), clock_(1) {} |
53 virtual ~ScreenshareLayerTest() {} | 53 virtual ~ScreenshareLayerTest() {} |
54 | 54 |
55 void SetUp() override { layers_.reset(new ScreenshareLayers(2, 0, &clock_)); } | 55 void SetUp() override { layers_.reset(new ScreenshareLayers(2, 0, &clock_)); } |
56 | 56 |
57 void EncodeFrame(uint32_t timestamp, | 57 void EncodeFrame(uint32_t timestamp, |
58 bool base_sync, | 58 bool base_sync, |
59 CodecSpecificInfoVP8* vp8_info, | 59 CodecSpecificInfoVP8* vp8_info, |
60 int* flags) { | 60 int* flags) { |
61 TemporalReferences tl_config = layers_->UpdateLayerConfig(timestamp); | 61 TemporalLayers::FrameConfig tl_config = |
| 62 layers_->UpdateLayerConfig(timestamp); |
62 if (tl_config.drop_frame) { | 63 if (tl_config.drop_frame) { |
63 *flags = -1; | 64 *flags = -1; |
64 return; | 65 return; |
65 } | 66 } |
66 *flags = VP8EncoderImpl::EncodeFlags(tl_config); | 67 *flags = VP8EncoderImpl::EncodeFlags(tl_config); |
67 layers_->PopulateCodecSpecific(base_sync, vp8_info, timestamp); | 68 layers_->PopulateCodecSpecific(base_sync, tl_config, vp8_info, timestamp); |
68 ASSERT_NE(-1, frame_size_); | 69 ASSERT_NE(-1, frame_size_); |
69 layers_->FrameEncoded(frame_size_, kDefaultQp); | 70 layers_->FrameEncoded(frame_size_, kDefaultQp); |
70 } | 71 } |
71 | 72 |
72 void ConfigureBitrates() { | 73 void ConfigureBitrates() { |
73 vpx_codec_enc_cfg_t vpx_cfg; | 74 vpx_codec_enc_cfg_t vpx_cfg; |
74 memset(&vpx_cfg, 0, sizeof(vpx_codec_enc_cfg_t)); | 75 memset(&vpx_cfg, 0, sizeof(vpx_codec_enc_cfg_t)); |
75 vpx_cfg.rc_min_quantizer = min_qp_; | 76 vpx_cfg.rc_min_quantizer = min_qp_; |
76 vpx_cfg.rc_max_quantizer = max_qp_; | 77 vpx_cfg.rc_max_quantizer = max_qp_; |
77 EXPECT_THAT(layers_->OnRatesUpdated(kDefaultTl0BitrateKbps, | 78 EXPECT_THAT(layers_->OnRatesUpdated(kDefaultTl0BitrateKbps, |
(...skipping 26 matching lines...) Expand all Loading... |
104 if (got_tl0 && got_tl1) | 105 if (got_tl0 && got_tl1) |
105 return timestamp; | 106 return timestamp; |
106 } | 107 } |
107 ADD_FAILURE() << "Frames from both layers not received in time."; | 108 ADD_FAILURE() << "Frames from both layers not received in time."; |
108 return 0; | 109 return 0; |
109 } | 110 } |
110 | 111 |
111 int SkipUntilTl(int layer, int timestamp) { | 112 int SkipUntilTl(int layer, int timestamp) { |
112 CodecSpecificInfoVP8 vp8_info; | 113 CodecSpecificInfoVP8 vp8_info; |
113 for (int i = 0; i < 5; ++i) { | 114 for (int i = 0; i < 5; ++i) { |
114 TemporalReferences tl_config = layers_->UpdateLayerConfig(timestamp); | 115 TemporalLayers::FrameConfig tl_config = |
| 116 layers_->UpdateLayerConfig(timestamp); |
115 VP8EncoderImpl::EncodeFlags(tl_config); | 117 VP8EncoderImpl::EncodeFlags(tl_config); |
116 timestamp += kTimestampDelta5Fps; | 118 timestamp += kTimestampDelta5Fps; |
117 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 119 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
118 if (vp8_info.temporalIdx != layer) { | 120 if (vp8_info.temporalIdx != layer) { |
119 layers_->FrameEncoded(frame_size_, kDefaultQp); | 121 layers_->FrameEncoded(frame_size_, kDefaultQp); |
120 } else { | 122 } else { |
121 return timestamp; | 123 return timestamp; |
122 } | 124 } |
123 } | 125 } |
124 ADD_FAILURE() << "Did not get a frame of TL" << layer << " in time."; | 126 ADD_FAILURE() << "Did not get a frame of TL" << layer << " in time."; |
125 return 0; | 127 return 0; |
126 } | 128 } |
127 | 129 |
(...skipping 14 matching lines...) Expand all Loading... |
142 | 144 |
143 TEST_F(ScreenshareLayerTest, 1Layer) { | 145 TEST_F(ScreenshareLayerTest, 1Layer) { |
144 layers_.reset(new ScreenshareLayers(1, 0, &clock_)); | 146 layers_.reset(new ScreenshareLayers(1, 0, &clock_)); |
145 ConfigureBitrates(); | 147 ConfigureBitrates(); |
146 int flags = 0; | 148 int flags = 0; |
147 uint32_t timestamp = 0; | 149 uint32_t timestamp = 0; |
148 CodecSpecificInfoVP8 vp8_info; | 150 CodecSpecificInfoVP8 vp8_info; |
149 // One layer screenshare should not use the frame dropper as all frames will | 151 // One layer screenshare should not use the frame dropper as all frames will |
150 // belong to the base layer. | 152 // belong to the base layer. |
151 const int kSingleLayerFlags = 0; | 153 const int kSingleLayerFlags = 0; |
152 flags = VP8EncoderImpl::EncodeFlags(layers_->UpdateLayerConfig(timestamp)); | 154 TemporalLayers::FrameConfig tl_config; |
| 155 tl_config = layers_->UpdateLayerConfig(timestamp); |
| 156 flags = VP8EncoderImpl::EncodeFlags(tl_config); |
153 EXPECT_EQ(kSingleLayerFlags, flags); | 157 EXPECT_EQ(kSingleLayerFlags, flags); |
154 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 158 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
155 EXPECT_EQ(static_cast<uint8_t>(kNoTemporalIdx), vp8_info.temporalIdx); | 159 EXPECT_EQ(static_cast<uint8_t>(kNoTemporalIdx), vp8_info.temporalIdx); |
156 EXPECT_FALSE(vp8_info.layerSync); | 160 EXPECT_FALSE(vp8_info.layerSync); |
157 EXPECT_EQ(kNoTl0PicIdx, vp8_info.tl0PicIdx); | 161 EXPECT_EQ(kNoTl0PicIdx, vp8_info.tl0PicIdx); |
158 layers_->FrameEncoded(frame_size_, kDefaultQp); | 162 layers_->FrameEncoded(frame_size_, kDefaultQp); |
159 flags = VP8EncoderImpl::EncodeFlags(layers_->UpdateLayerConfig(timestamp)); | 163 tl_config = layers_->UpdateLayerConfig(timestamp); |
| 164 flags = VP8EncoderImpl::EncodeFlags(tl_config); |
160 EXPECT_EQ(kSingleLayerFlags, flags); | 165 EXPECT_EQ(kSingleLayerFlags, flags); |
161 timestamp += kTimestampDelta5Fps; | 166 timestamp += kTimestampDelta5Fps; |
162 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 167 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
163 EXPECT_EQ(static_cast<uint8_t>(kNoTemporalIdx), vp8_info.temporalIdx); | 168 EXPECT_EQ(static_cast<uint8_t>(kNoTemporalIdx), vp8_info.temporalIdx); |
164 EXPECT_FALSE(vp8_info.layerSync); | 169 EXPECT_FALSE(vp8_info.layerSync); |
165 EXPECT_EQ(kNoTl0PicIdx, vp8_info.tl0PicIdx); | 170 EXPECT_EQ(kNoTl0PicIdx, vp8_info.tl0PicIdx); |
166 layers_->FrameEncoded(frame_size_, kDefaultQp); | 171 layers_->FrameEncoded(frame_size_, kDefaultQp); |
167 } | 172 } |
168 | 173 |
169 TEST_F(ScreenshareLayerTest, 2Layer) { | 174 TEST_F(ScreenshareLayerTest, 2Layer) { |
170 ConfigureBitrates(); | 175 ConfigureBitrates(); |
171 int flags = 0; | 176 int flags = 0; |
172 uint32_t timestamp = 0; | 177 uint32_t timestamp = 0; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 242 |
238 TEST_F(ScreenshareLayerTest, 2LayersSyncAfterTimeout) { | 243 TEST_F(ScreenshareLayerTest, 2LayersSyncAfterTimeout) { |
239 ConfigureBitrates(); | 244 ConfigureBitrates(); |
240 uint32_t timestamp = 0; | 245 uint32_t timestamp = 0; |
241 CodecSpecificInfoVP8 vp8_info; | 246 CodecSpecificInfoVP8 vp8_info; |
242 std::vector<int> sync_times; | 247 std::vector<int> sync_times; |
243 | 248 |
244 const int kNumFrames = kMaxSyncPeriodSeconds * kFrameRate * 2 - 1; | 249 const int kNumFrames = kMaxSyncPeriodSeconds * kFrameRate * 2 - 1; |
245 for (int i = 0; i < kNumFrames; ++i) { | 250 for (int i = 0; i < kNumFrames; ++i) { |
246 timestamp += kTimestampDelta5Fps; | 251 timestamp += kTimestampDelta5Fps; |
247 layers_->UpdateLayerConfig(timestamp); | 252 TemporalLayers::FrameConfig tl_config = |
248 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 253 layers_->UpdateLayerConfig(timestamp); |
| 254 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
249 | 255 |
250 // Simulate TL1 being at least 8 qp steps better. | 256 // Simulate TL1 being at least 8 qp steps better. |
251 if (vp8_info.temporalIdx == 0) { | 257 if (vp8_info.temporalIdx == 0) { |
252 layers_->FrameEncoded(frame_size_, kDefaultQp); | 258 layers_->FrameEncoded(frame_size_, kDefaultQp); |
253 } else { | 259 } else { |
254 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); | 260 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); |
255 } | 261 } |
256 | 262 |
257 if (vp8_info.temporalIdx == 1 && vp8_info.layerSync) | 263 if (vp8_info.temporalIdx == 1 && vp8_info.layerSync) |
258 sync_times.push_back(timestamp); | 264 sync_times.push_back(timestamp); |
259 } | 265 } |
260 | 266 |
261 ASSERT_EQ(2u, sync_times.size()); | 267 ASSERT_EQ(2u, sync_times.size()); |
262 EXPECT_GE(sync_times[1] - sync_times[0], 90000 * kMaxSyncPeriodSeconds); | 268 EXPECT_GE(sync_times[1] - sync_times[0], 90000 * kMaxSyncPeriodSeconds); |
263 } | 269 } |
264 | 270 |
265 TEST_F(ScreenshareLayerTest, 2LayersSyncAfterSimilarQP) { | 271 TEST_F(ScreenshareLayerTest, 2LayersSyncAfterSimilarQP) { |
266 ConfigureBitrates(); | 272 ConfigureBitrates(); |
267 uint32_t timestamp = 0; | 273 uint32_t timestamp = 0; |
268 CodecSpecificInfoVP8 vp8_info; | 274 CodecSpecificInfoVP8 vp8_info; |
269 std::vector<int> sync_times; | 275 std::vector<int> sync_times; |
270 | 276 |
271 const int kNumFrames = (kSyncPeriodSeconds + | 277 const int kNumFrames = (kSyncPeriodSeconds + |
272 ((kMaxSyncPeriodSeconds - kSyncPeriodSeconds) / 2)) * | 278 ((kMaxSyncPeriodSeconds - kSyncPeriodSeconds) / 2)) * |
273 kFrameRate; | 279 kFrameRate; |
274 for (int i = 0; i < kNumFrames; ++i) { | 280 for (int i = 0; i < kNumFrames; ++i) { |
275 timestamp += kTimestampDelta5Fps; | 281 timestamp += kTimestampDelta5Fps; |
276 layers_->UpdateLayerConfig(timestamp); | 282 TemporalLayers::FrameConfig tl_config = |
277 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 283 layers_->UpdateLayerConfig(timestamp); |
| 284 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
278 | 285 |
279 // Simulate TL1 being at least 8 qp steps better. | 286 // Simulate TL1 being at least 8 qp steps better. |
280 if (vp8_info.temporalIdx == 0) { | 287 if (vp8_info.temporalIdx == 0) { |
281 layers_->FrameEncoded(frame_size_, kDefaultQp); | 288 layers_->FrameEncoded(frame_size_, kDefaultQp); |
282 } else { | 289 } else { |
283 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); | 290 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); |
284 } | 291 } |
285 | 292 |
286 if (vp8_info.temporalIdx == 1 && vp8_info.layerSync) | 293 if (vp8_info.temporalIdx == 1 && vp8_info.layerSync) |
287 sync_times.push_back(timestamp); | 294 sync_times.push_back(timestamp); |
288 } | 295 } |
289 | 296 |
290 ASSERT_EQ(1u, sync_times.size()); | 297 ASSERT_EQ(1u, sync_times.size()); |
291 | 298 |
292 bool bumped_tl0_quality = false; | 299 bool bumped_tl0_quality = false; |
293 for (int i = 0; i < 3; ++i) { | 300 for (int i = 0; i < 3; ++i) { |
294 timestamp += kTimestampDelta5Fps; | 301 timestamp += kTimestampDelta5Fps; |
295 TemporalReferences tl_config = layers_->UpdateLayerConfig(timestamp); | 302 TemporalLayers::FrameConfig tl_config = |
| 303 layers_->UpdateLayerConfig(timestamp); |
296 int flags = VP8EncoderImpl::EncodeFlags(tl_config); | 304 int flags = VP8EncoderImpl::EncodeFlags(tl_config); |
297 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 305 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
298 | 306 |
299 if (vp8_info.temporalIdx == 0) { | 307 if (vp8_info.temporalIdx == 0) { |
300 // Bump TL0 to same quality as TL1. | 308 // Bump TL0 to same quality as TL1. |
301 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); | 309 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); |
302 bumped_tl0_quality = true; | 310 bumped_tl0_quality = true; |
303 } else { | 311 } else { |
304 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); | 312 layers_->FrameEncoded(frame_size_, kDefaultQp - 8); |
305 if (bumped_tl0_quality) { | 313 if (bumped_tl0_quality) { |
306 EXPECT_TRUE(vp8_info.layerSync); | 314 EXPECT_TRUE(vp8_info.layerSync); |
307 EXPECT_EQ(kTl1SyncFlags, flags); | 315 EXPECT_EQ(kTl1SyncFlags, flags); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // Updates cfg with current target bitrate. | 443 // Updates cfg with current target bitrate. |
436 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); | 444 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); |
437 | 445 |
438 uint32_t timestamp = RunGracePeriod(); | 446 uint32_t timestamp = RunGracePeriod(); |
439 timestamp = SkipUntilTl(0, timestamp); | 447 timestamp = SkipUntilTl(0, timestamp); |
440 | 448 |
441 // Size 0 indicates dropped frame. | 449 // Size 0 indicates dropped frame. |
442 layers_->FrameEncoded(0, kDefaultQp); | 450 layers_->FrameEncoded(0, kDefaultQp); |
443 timestamp += kTimestampDelta5Fps; | 451 timestamp += kTimestampDelta5Fps; |
444 EXPECT_FALSE(layers_->UpdateConfiguration(&cfg)); | 452 EXPECT_FALSE(layers_->UpdateConfiguration(&cfg)); |
445 EXPECT_EQ(kTl0Flags, | 453 TemporalLayers::FrameConfig tl_config = layers_->UpdateLayerConfig(timestamp); |
446 VP8EncoderImpl::EncodeFlags(layers_->UpdateLayerConfig(timestamp))); | 454 EXPECT_EQ(kTl0Flags, VP8EncoderImpl::EncodeFlags(tl_config)); |
447 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 455 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
448 layers_->FrameEncoded(frame_size_, kDefaultQp); | 456 layers_->FrameEncoded(frame_size_, kDefaultQp); |
449 | 457 |
450 timestamp = SkipUntilTl(0, timestamp); | 458 timestamp = SkipUntilTl(0, timestamp); |
451 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); | 459 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); |
452 EXPECT_LT(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); | 460 EXPECT_LT(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); |
453 layers_->FrameEncoded(frame_size_, kDefaultQp); | 461 layers_->FrameEncoded(frame_size_, kDefaultQp); |
454 | 462 |
455 layers_->UpdateLayerConfig(timestamp); | 463 tl_config = layers_->UpdateLayerConfig(timestamp); |
456 timestamp += kTimestampDelta5Fps; | 464 timestamp += kTimestampDelta5Fps; |
457 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); | 465 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); |
458 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 466 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
459 EXPECT_EQ(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); | 467 EXPECT_EQ(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); |
460 layers_->FrameEncoded(frame_size_, kDefaultQp); | 468 layers_->FrameEncoded(frame_size_, kDefaultQp); |
461 | 469 |
462 // Next drop in TL1. | 470 // Next drop in TL1. |
463 | 471 |
464 timestamp = SkipUntilTl(1, timestamp); | 472 timestamp = SkipUntilTl(1, timestamp); |
465 layers_->FrameEncoded(0, kDefaultQp); | 473 layers_->FrameEncoded(0, kDefaultQp); |
466 timestamp += kTimestampDelta5Fps; | 474 timestamp += kTimestampDelta5Fps; |
467 EXPECT_FALSE(layers_->UpdateConfiguration(&cfg)); | 475 EXPECT_FALSE(layers_->UpdateConfiguration(&cfg)); |
468 EXPECT_EQ(kTl1Flags, | 476 tl_config = layers_->UpdateLayerConfig(timestamp); |
469 VP8EncoderImpl::EncodeFlags(layers_->UpdateLayerConfig(timestamp))); | 477 EXPECT_EQ(kTl1Flags, VP8EncoderImpl::EncodeFlags(tl_config)); |
470 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 478 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
471 layers_->FrameEncoded(frame_size_, kDefaultQp); | 479 layers_->FrameEncoded(frame_size_, kDefaultQp); |
472 | 480 |
473 timestamp = SkipUntilTl(1, timestamp); | 481 timestamp = SkipUntilTl(1, timestamp); |
474 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); | 482 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); |
475 EXPECT_LT(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); | 483 EXPECT_LT(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); |
476 layers_->FrameEncoded(frame_size_, kDefaultQp); | 484 layers_->FrameEncoded(frame_size_, kDefaultQp); |
477 | 485 |
478 layers_->UpdateLayerConfig(timestamp); | 486 tl_config = layers_->UpdateLayerConfig(timestamp); |
479 timestamp += kTimestampDelta5Fps; | 487 timestamp += kTimestampDelta5Fps; |
480 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); | 488 EXPECT_TRUE(layers_->UpdateConfiguration(&cfg)); |
481 layers_->PopulateCodecSpecific(false, &vp8_info, timestamp); | 489 layers_->PopulateCodecSpecific(false, tl_config, &vp8_info, timestamp); |
482 EXPECT_EQ(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); | 490 EXPECT_EQ(cfg.rc_max_quantizer, static_cast<unsigned int>(kDefaultQp)); |
483 layers_->FrameEncoded(frame_size_, kDefaultQp); | 491 layers_->FrameEncoded(frame_size_, kDefaultQp); |
484 } | 492 } |
485 | 493 |
486 TEST_F(ScreenshareLayerTest, RespectsMaxIntervalBetweenFrames) { | 494 TEST_F(ScreenshareLayerTest, RespectsMaxIntervalBetweenFrames) { |
487 const int kLowBitrateKbps = 50; | 495 const int kLowBitrateKbps = 50; |
488 const int kLargeFrameSizeBytes = 100000; | 496 const int kLargeFrameSizeBytes = 100000; |
489 const uint32_t kStartTimestamp = 1234; | 497 const uint32_t kStartTimestamp = 1234; |
490 | 498 |
491 vpx_codec_enc_cfg_t cfg = GetConfig(); | 499 vpx_codec_enc_cfg_t cfg = GetConfig(); |
(...skipping 23 matching lines...) Expand all Loading... |
515 ConfigureBitrates(); | 523 ConfigureBitrates(); |
516 vpx_codec_enc_cfg_t cfg = GetConfig(); | 524 vpx_codec_enc_cfg_t cfg = GetConfig(); |
517 bool trigger_drop = false; | 525 bool trigger_drop = false; |
518 bool dropped_frame = false; | 526 bool dropped_frame = false; |
519 bool overshoot = false; | 527 bool overshoot = false; |
520 const int kTl0Qp = 35; | 528 const int kTl0Qp = 35; |
521 const int kTl1Qp = 30; | 529 const int kTl1Qp = 30; |
522 for (int64_t timestamp = 0; | 530 for (int64_t timestamp = 0; |
523 timestamp < kTimestampDelta5Fps * 5 * metrics::kMinRunTimeInSeconds; | 531 timestamp < kTimestampDelta5Fps * 5 * metrics::kMinRunTimeInSeconds; |
524 timestamp += kTimestampDelta5Fps) { | 532 timestamp += kTimestampDelta5Fps) { |
525 TemporalReferences tl_config = layers_->UpdateLayerConfig(timestamp); | 533 TemporalLayers::FrameConfig tl_config = |
| 534 layers_->UpdateLayerConfig(timestamp); |
526 if (tl_config.drop_frame) { | 535 if (tl_config.drop_frame) { |
527 dropped_frame = true; | 536 dropped_frame = true; |
528 continue; | 537 continue; |
529 } | 538 } |
530 int flags = VP8EncoderImpl::EncodeFlags(tl_config); | 539 int flags = VP8EncoderImpl::EncodeFlags(tl_config); |
531 if (flags != -1) | 540 if (flags != -1) |
532 layers_->UpdateConfiguration(&cfg); | 541 layers_->UpdateConfiguration(&cfg); |
533 | 542 |
534 if (timestamp >= kTimestampDelta5Fps * 5 && !overshoot && flags != -1) { | 543 if (timestamp >= kTimestampDelta5Fps * 5 && !overshoot && flags != -1) { |
535 // Simulate one overshoot. | 544 // Simulate one overshoot. |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 } | 643 } |
635 timestamp += kFrameIntervalsMs * 90 / 2; | 644 timestamp += kFrameIntervalsMs * 90 / 2; |
636 clock_.AdvanceTimeMilliseconds(kFrameIntervalsMs / 2); | 645 clock_.AdvanceTimeMilliseconds(kFrameIntervalsMs / 2); |
637 ++num_input_frames; | 646 ++num_input_frames; |
638 } | 647 } |
639 | 648 |
640 // Allow for some rounding errors in the measurements. | 649 // Allow for some rounding errors in the measurements. |
641 EXPECT_NEAR(num_discarded_frames, num_input_frames / 2, 2); | 650 EXPECT_NEAR(num_discarded_frames, num_input_frames / 2, 2); |
642 } | 651 } |
643 } // namespace webrtc | 652 } // namespace webrtc |
OLD | NEW |