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

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: Remove duplicate SetOptions code 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 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 } 2094 }
2095 2095
2096 TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) { 2096 TEST_F(WebRtcVideoChannel2Test, SetMaxSendBitrateCanIncreaseSenderBitrate) {
2097 cricket::VideoSendParameters parameters; 2097 cricket::VideoSendParameters parameters;
2098 parameters.codecs.push_back(kVp8Codec720p); 2098 parameters.codecs.push_back(kVp8Codec720p);
2099 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2099 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2100 channel_->SetSend(true); 2100 channel_->SetSend(true);
2101 2101
2102 FakeVideoSendStream* stream = AddSendStream(); 2102 FakeVideoSendStream* stream = AddSendStream();
2103 2103
2104 cricket::FakeVideoCapturer capturer;
2105 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, &capturer));
2106 EXPECT_EQ(cricket::CS_RUNNING,
2107 capturer.Start(capturer.GetSupportedFormats()->front()));
2108
2104 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams(); 2109 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams();
2105 int initial_max_bitrate_bps = streams[0].max_bitrate_bps; 2110 int initial_max_bitrate_bps = streams[0].max_bitrate_bps;
2106 EXPECT_GT(initial_max_bitrate_bps, 0); 2111 EXPECT_GT(initial_max_bitrate_bps, 0);
2107 2112
2108 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2; 2113 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2;
2109 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 2114 EXPECT_TRUE(channel_->SetSendParameters(parameters));
2115 // Insert a frame to update the encoder config.
2116 EXPECT_TRUE(capturer.CaptureFrame());
2110 streams = stream->GetVideoStreams(); 2117 streams = stream->GetVideoStreams();
2111 EXPECT_EQ(initial_max_bitrate_bps * 2, streams[0].max_bitrate_bps); 2118 EXPECT_EQ(initial_max_bitrate_bps * 2, streams[0].max_bitrate_bps);
2119 EXPECT_TRUE(channel_->SetCapturer(last_ssrc_, nullptr));
2112 } 2120 }
2113 2121
2114 TEST_F(WebRtcVideoChannel2Test, 2122 TEST_F(WebRtcVideoChannel2Test,
2115 SetMaxSendBitrateCanIncreaseSimulcastSenderBitrate) { 2123 SetMaxSendBitrateCanIncreaseSimulcastSenderBitrate) {
2116 cricket::VideoSendParameters parameters; 2124 cricket::VideoSendParameters parameters;
2117 parameters.codecs.push_back(kVp8Codec720p); 2125 parameters.codecs.push_back(kVp8Codec720p);
2118 ASSERT_TRUE(channel_->SetSendParameters(parameters)); 2126 ASSERT_TRUE(channel_->SetSendParameters(parameters));
2119 channel_->SetSend(true); 2127 channel_->SetSend(true);
2120 2128
2121 FakeVideoSendStream* stream = AddSendStream( 2129 FakeVideoSendStream* stream = AddSendStream(
2122 cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3))); 2130 cricket::CreateSimStreamParams("cname", MAKE_VECTOR(kSsrcs3)));
2123 2131
2124 // Send a frame to make sure this scales up to >1 stream (simulcast). 2132 // Send a frame to make sure this scales up to >1 stream (simulcast).
2125 cricket::FakeVideoCapturer capturer; 2133 cricket::FakeVideoCapturer capturer;
2126 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], &capturer)); 2134 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], &capturer));
2127 EXPECT_EQ(cricket::CS_RUNNING, 2135 EXPECT_EQ(cricket::CS_RUNNING,
2128 capturer.Start(capturer.GetSupportedFormats()->front())); 2136 capturer.Start(capturer.GetSupportedFormats()->front()));
2129 EXPECT_TRUE(capturer.CaptureFrame()); 2137 EXPECT_TRUE(capturer.CaptureFrame());
2130 2138
2131 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams(); 2139 std::vector<webrtc::VideoStream> streams = stream->GetVideoStreams();
2132 ASSERT_GT(streams.size(), 1u) 2140 ASSERT_GT(streams.size(), 1u)
2133 << "Without simulcast this test doesn't make sense."; 2141 << "Without simulcast this test doesn't make sense.";
2134 int initial_max_bitrate_bps = GetTotalMaxBitrateBps(streams); 2142 int initial_max_bitrate_bps = GetTotalMaxBitrateBps(streams);
2135 EXPECT_GT(initial_max_bitrate_bps, 0); 2143 EXPECT_GT(initial_max_bitrate_bps, 0);
2136 2144
2137 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2; 2145 parameters.max_bandwidth_bps = initial_max_bitrate_bps * 2;
2138 EXPECT_TRUE(channel_->SetSendParameters(parameters)); 2146 EXPECT_TRUE(channel_->SetSendParameters(parameters));
2147 // Insert a frame to update the encoder config.
2148 EXPECT_TRUE(capturer.CaptureFrame());
2139 streams = stream->GetVideoStreams(); 2149 streams = stream->GetVideoStreams();
2140 int increased_max_bitrate_bps = GetTotalMaxBitrateBps(streams); 2150 int increased_max_bitrate_bps = GetTotalMaxBitrateBps(streams);
2141 EXPECT_EQ(initial_max_bitrate_bps * 2, increased_max_bitrate_bps); 2151 EXPECT_EQ(initial_max_bitrate_bps * 2, increased_max_bitrate_bps);
2142 2152
2143 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], nullptr)); 2153 EXPECT_TRUE(channel_->SetCapturer(kSsrcs3[0], nullptr));
2144 } 2154 }
2145 2155
2146 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) { 2156 TEST_F(WebRtcVideoChannel2Test, SetSendCodecsWithMaxQuantization) {
2147 static const char* kMaxQuantization = "21"; 2157 static const char* kMaxQuantization = "21";
2148 cricket::VideoSendParameters parameters; 2158 cricket::VideoSendParameters parameters;
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 // Ensures that the correct settings are applied to the codec when two temporal 3410 // Ensures that the correct settings are applied to the codec when two temporal
3401 // layer screencasting is enabled, and that the correct simulcast settings are 3411 // layer screencasting is enabled, and that the correct simulcast settings are
3402 // reapplied when disabling screencasting. 3412 // reapplied when disabling screencasting.
3403 TEST_F(WebRtcVideoChannel2SimulcastTest, 3413 TEST_F(WebRtcVideoChannel2SimulcastTest,
3404 DISABLED_TwoTemporalLayerScreencastSettings) { 3414 DISABLED_TwoTemporalLayerScreencastSettings) {
3405 // TODO(pbos): Implement. 3415 // TODO(pbos): Implement.
3406 FAIL() << "Not implemented."; 3416 FAIL() << "Not implemented.";
3407 } 3417 }
3408 3418
3409 } // namespace cricket 3419 } // 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