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

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

Issue 1561073006: Consolidate SetSendParameters into one setter. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: deadbeef@ feedback Created 4 years, 11 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 * libjingle 2 * libjingle
3 * Copyright 2004 Google Inc. 3 * Copyright 2004 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 2080 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 } 2091 }
2092 2092
2093 TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) { 2093 TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) {
2094 cricket::VideoSendParameters parameters; 2094 cricket::VideoSendParameters parameters;
2095 parameters.codecs.push_back(kVp8Codec720p); 2095 parameters.codecs.push_back(kVp8Codec720p);
2096 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2096 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2097 channel_->SetSend(true); 2097 channel_->SetSend(true);
2098 2098
2099 FakeVideoSendStream* stream = AddSendStream(); 2099 FakeVideoSendStream* stream = AddSendStream();
2100 2100
2101 cricket::FakeVideoCapturer capturer;
2102 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
2103 EXPECT_EQ(cricket::CS_RUNNING,
2104 capturer.Start(capturer.GetSupportedFormats()->front()));
2105
2101 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams(); 2106 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams();
2102 int initial_max_bitrate_bps = streams[0].max_bitrate_bps; 2107 int initial_max_bitrate_bps = streams[0].max_bitrate_bps;
2103 EXPECT_GT(initial_max_bitrate_bps, 0); 2108 EXPECT_GT(initial_max_bitrate_bps, 0);
2104 2109
2105 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2; 2110 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2;
2106 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 2111 EXPECT_TRUE(channel_->SetSendParameters(parameters));
2112 // Insert a frame to update the encoder config.
2113 EXPECT_TRUE(capturer.CaptureFrame());
2107 streams = stream->GetVideoStreams(); 2114 streams = stream->GetVideoStreams();
2108 EXPECT_EQ(initial_max_bitrate_bps * 2, streams[0].max_bitrate_bps); 2115 EXPECT_EQ(initial_max_bitrate_bps * 2, streams[0].max_bitrate_bps);
2116 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, nullptr));
2109 } 2117 }
2110 2118
2111 TEST_F(WebRtcVideoChannel2Test, 2119 TEST_F(WebRtcVideoChannel2Test,
2112 SetMaxSendBitrateCanIncreaseSimulcastSenderBitrate) { 2120 SetMaxSendBitrateCanIncreaseSimulcastSenderBitrate) {
2113 cricket::VideoSendParameters parameters; 2121 cricket::VideoSendParameters parameters;
2114 parameters.codecs.push_back(kVp8Codec720p); 2122 parameters.codecs.push_back(kVp8Codec720p);
2115 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2123 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2116 channel_->SetSend(true); 2124 channel_->SetSend(true);
2117 2125
2118 FakeVideoSendStream* stream = AddSendStream( 2126 FakeVideoSendStream* stream = AddSendStream(
2119 cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3))); 2127 cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3)));
2120 2128
2121 // Send a frame to make sure this scales up to >1 stream (simulcast). 2129 // Send a frame to make sure this scales up to >1 stream (simulcast).
2122 cricket::FakeVideoCapturer capturer; 2130 cricket::FakeVideoCapturer capturer;
2123 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], &capturer)); 2131 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], &capturer));
2124 EXPECT_EQ(cricket::CS_RUNNING, 2132 EXPECT_EQ(cricket::CS_RUNNING,
2125 capturer.Start(capturer.GetSupportedFormats()->front())); 2133 capturer.Start(capturer.GetSupportedFormats()->front()));
2126 EXPECT_TRUE(capturer.CaptureFrame()); 2134 EXPECT_TRUE(capturer.CaptureFrame());
2127 2135
2128 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams(); 2136 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams();
2129 ASSERT_GT(streams.size(), 1u) 2137 ASSERT_GT(streams.size(), 1u)
2130 << "Without simulcast this test doesn't make sense."; 2138 << "Without simulcast this test doesn't make sense.";
2131 int initial_max_bitrate_bps = GetTotalMaxBitrateBps(streams); 2139 int initial_max_bitrate_bps = GetTotalMaxBitrateBps(streams);
2132 EXPECT_GT(initial_max_bitrate_bps, 0); 2140 EXPECT_GT(initial_max_bitrate_bps, 0);
2133 2141
2134 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2; 2142 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2;
2135 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 2143 EXPECT_TRUE(channel_->SetSendParameters(parameters));
2144 // Insert a frame to update the encoder config.
2145 EXPECT_TRUE(capturer.CaptureFrame());
2136 streams = stream->GetVideoStreams(); 2146 streams = stream->GetVideoStreams();
2137 int increased_max_bitrate_bps = GetTotalMaxBitrateBps(streams); 2147 int increased_max_bitrate_bps = GetTotalMaxBitrateBps(streams);
2138 EXPECT_EQ(initial_max_bitrate_bps * 2, increased_max_bitrate_bps); 2148 EXPECT_EQ(initial_max_bitrate_bps * 2, increased_max_bitrate_bps);
2139 2149
2140 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], nullptr)); 2150 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], nullptr));
2141 } 2151 }
2142 2152
2143 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) { 2153 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) {
2144 static const char* kMaxQuantization = "21"; 2154 static const char* kMaxQuantization = "21";
2145 cricket::VideoSendParameters parameters; 2155 cricket::VideoSendParameters parameters;
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 // Ensures that the correct settings are applied to the codec when two temporal 3407 // Ensures that the correct settings are applied to the codec when two temporal
3398 // layer screencasting is enabled, and that the correct simulcast settings are 3408 // layer screencasting is enabled, and that the correct simulcast settings are
3399 // reapplied when disabling screencasting. 3409 // reapplied when disabling screencasting.
3400 TEST_F(WebRtcVideoChannel2SimulcastTest, 3410 TEST_F(WebRtcVideoChannel2SimulcastTest,
3401 DISABLED_TwoTemporalLayerScreencastSettings) { 3411 DISABLED_TwoTemporalLayerScreencastSettings) {
3402 // TODO(pbos): Implement. 3412 // TODO(pbos): Implement.
3403 FAIL() << "Not implemented."; 3413 FAIL() << "Not implemented.";
3404 } 3414 }
3405 3415
3406 } // namespace cricket 3416 } // namespace cricket
OLDNEW
« talk/media/webrtc/webrtcvideoengine2.cc ('K') | « talk/media/webrtc/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698