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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2_unittest.cc

Issue 1790703002: Reconfigure video encoders even when not sending. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: feedback + compile Created 4 years, 9 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
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 // Verify that NACK is turned on when setting default codecs since the 1477 // Verify that NACK is turned on when setting default codecs since the
1478 // default codecs have NACK enabled. 1478 // default codecs have NACK enabled.
1479 parameters.codecs = engine_.codecs(); 1479 parameters.codecs = engine_.codecs();
1480 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1480 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1481 recv_stream = fake_call_->GetVideoReceiveStreams()[0]; 1481 recv_stream = fake_call_->GetVideoReceiveStreams()[0];
1482 EXPECT_GT(recv_stream->GetConfig().rtp.nack.rtp_history_ms, 0); 1482 EXPECT_GT(recv_stream->GetConfig().rtp.nack.rtp_history_ms, 0);
1483 send_stream = fake_call_->GetVideoSendStreams()[0]; 1483 send_stream = fake_call_->GetVideoSendStreams()[0];
1484 EXPECT_GT(send_stream->GetConfig().rtp.nack.rtp_history_ms, 0); 1484 EXPECT_GT(send_stream->GetConfig().rtp.nack.rtp_history_ms, 0);
1485 } 1485 }
1486 1486
1487 // This test verifies that new frame sizes reconfigures encoders even though not
1488 // (yet) sending. The purpose of this is to permit encoding as quickly as
1489 // possible once we start sending. Likely the frames being input are from the
1490 // same source that will be sent later, which just means that we're ready
1491 // earlier.
1492 TEST_F(WebRtcVideoChannel2Test, ReconfiguresEncodersWhenNotSending) {
1493 cricket::VideoSendParameters parameters;
1494 parameters.codecs.push_back(kVp8Codec720p);
1495 ASSERT_TRUE(channel_->SetSendParameters(parameters));
1496 channel_->SetSend(false);
1497
1498 FakeVideoSendStream* stream = AddSendStream();
1499
1500 // No frames entered, using default dimensions.
1501 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams();
1502 EXPECT_EQ(176u, streams[0].width);
1503 EXPECT_EQ(144u, streams[0].height);
1504
1505 cricket::FakeVideoCapturer capturer;
1506 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
1507 EXPECT_EQ(cricket::CS_RUNNING,
1508 capturer.Start(capturer.GetSupportedFormats()->front()));
1509 EXPECT_TRUE(capturer.CaptureFrame());
1510
1511 // Frame entered, should be reconfigured to new dimensions.
1512 streams = stream->GetVideoStreams();
1513 EXPECT_EQ(kVp8Codec720p.width, streams[0].width);
1514 EXPECT_EQ(kVp8Codec720p.height, streams[0].height);
1515 // No frames should have been actually put in there though.
1516 EXPECT_EQ(0, stream->GetNumberOfSwappedFrames());
1517
1518 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, NULL));
1519 }
1520
1487 TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) { 1521 TEST_F(WebRtcVideoChannel2Test, UsesCorrectSettingsForScreencast) {
1488 static const int kScreenshareMinBitrateKbps = 800; 1522 static const int kScreenshareMinBitrateKbps = 800;
1489 cricket::VideoCodec codec = kVp8Codec360p; 1523 cricket::VideoCodec codec = kVp8Codec360p;
1490 cricket::VideoSendParameters parameters; 1524 cricket::VideoSendParameters parameters;
1491 parameters.codecs.push_back(codec); 1525 parameters.codecs.push_back(codec);
1492 parameters.options.screencast_min_bitrate_kbps = 1526 parameters.options.screencast_min_bitrate_kbps =
1493 rtc::Optional<int>(kScreenshareMinBitrateKbps); 1527 rtc::Optional<int>(kScreenshareMinBitrateKbps);
1494 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 1528 EXPECT_TRUE(channel_->SetSendParameters(parameters));
1495 1529
1496 AddSendStream(); 1530 AddSendStream();
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 3286
3253 // Test that we normalize send codec format size in simulcast. 3287 // Test that we normalize send codec format size in simulcast.
3254 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3288 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3255 cricket::VideoCodec codec(kVp8Codec270p); 3289 cricket::VideoCodec codec(kVp8Codec270p);
3256 codec.width += 1; 3290 codec.width += 1;
3257 codec.height += 1; 3291 codec.height += 1;
3258 VerifySimulcastSettings(codec, 2, 2); 3292 VerifySimulcastSettings(codec, 2, 2);
3259 } 3293 }
3260 } // namespace cricket 3294 } // namespace cricket
3261 3295
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698