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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 EXPECT_EQ(0, sender_->IntraFrameRequest(0)); | 310 EXPECT_EQ(0, sender_->IntraFrameRequest(0)); |
311 ExpectIntraRequest(1); | 311 ExpectIntraRequest(1); |
312 EXPECT_EQ(0, sender_->IntraFrameRequest(1)); | 312 EXPECT_EQ(0, sender_->IntraFrameRequest(1)); |
313 ExpectIntraRequest(2); | 313 ExpectIntraRequest(2); |
314 EXPECT_EQ(0, sender_->IntraFrameRequest(2)); | 314 EXPECT_EQ(0, sender_->IntraFrameRequest(2)); |
315 // No requests expected since these indices are out of bounds. | 315 // No requests expected since these indices are out of bounds. |
316 EXPECT_EQ(-1, sender_->IntraFrameRequest(3)); | 316 EXPECT_EQ(-1, sender_->IntraFrameRequest(3)); |
317 EXPECT_EQ(-1, sender_->IntraFrameRequest(-1)); | 317 EXPECT_EQ(-1, sender_->IntraFrameRequest(-1)); |
318 } | 318 } |
319 | 319 |
| 320 TEST_F(TestVideoSenderWithMockEncoder, TestEncoderParametersForInternalSource) { |
| 321 // De-register current external encoder. |
| 322 sender_->RegisterExternalEncoder(nullptr, kUnusedPayloadType, false); |
| 323 // Register encoder with internal capture. |
| 324 sender_->RegisterExternalEncoder(&encoder_, kUnusedPayloadType, true); |
| 325 EXPECT_EQ(0, sender_->RegisterSendCodec(&settings_, 1, 1200)); |
| 326 // Update encoder bitrate parameters. We expect that to immediately call |
| 327 // SetRates on the encoder without waiting for AddFrame processing. |
| 328 const uint32_t new_bitrate = settings_.startBitrate + 300; |
| 329 EXPECT_CALL(encoder_, SetRates(new_bitrate, _)).Times(1).WillOnce(Return(0)); |
| 330 sender_->SetChannelParameters(new_bitrate * 1000, 0, 200); |
| 331 } |
| 332 |
320 TEST_F(TestVideoSenderWithMockEncoder, EncoderFramerateUpdatedViaProcess) { | 333 TEST_F(TestVideoSenderWithMockEncoder, EncoderFramerateUpdatedViaProcess) { |
321 sender_->SetChannelParameters(settings_.startBitrate * 1000, 0, 200); | 334 sender_->SetChannelParameters(settings_.startBitrate * 1000, 0, 200); |
322 const int64_t kRateStatsWindowMs = 2000; | 335 const int64_t kRateStatsWindowMs = 2000; |
323 const uint32_t kInputFps = 20; | 336 const uint32_t kInputFps = 20; |
324 int64_t start_time = clock_.TimeInMilliseconds(); | 337 int64_t start_time = clock_.TimeInMilliseconds(); |
325 while (clock_.TimeInMilliseconds() < start_time + kRateStatsWindowMs) { | 338 while (clock_.TimeInMilliseconds() < start_time + kRateStatsWindowMs) { |
326 AddFrame(); | 339 AddFrame(); |
327 clock_.AdvanceTimeMilliseconds(1000 / kInputFps); | 340 clock_.AdvanceTimeMilliseconds(1000 / kInputFps); |
328 } | 341 } |
329 EXPECT_CALL(encoder_, SetRates(_, kInputFps)).Times(1).WillOnce(Return(0)); | 342 EXPECT_CALL(encoder_, SetRates(_, kInputFps)).Times(1).WillOnce(Return(0)); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 503 } |
491 { | 504 { |
492 // TODO(andresp): Find out why this fails with framerate = 7.5 | 505 // TODO(andresp): Find out why this fails with framerate = 7.5 |
493 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; | 506 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; |
494 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); | 507 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); |
495 } | 508 } |
496 } | 509 } |
497 } // namespace | 510 } // namespace |
498 } // namespace vcm | 511 } // namespace vcm |
499 } // namespace webrtc | 512 } // namespace webrtc |
OLD | NEW |