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

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

Issue 1822923002: Adding support for RTCRtpEncodingParameters.active flag. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Switch to C++11 for loop. 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
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 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after
3260 EXPECT_EQ(0, nonexistent_parameters.encodings.size()); 3260 EXPECT_EQ(0, nonexistent_parameters.encodings.size());
3261 3261
3262 nonexistent_parameters.encodings.push_back(webrtc::RtpEncodingParameters()); 3262 nonexistent_parameters.encodings.push_back(webrtc::RtpEncodingParameters());
3263 EXPECT_FALSE(channel_->SetRtpParameters(last_ssrc_, nonexistent_parameters)); 3263 EXPECT_FALSE(channel_->SetRtpParameters(last_ssrc_, nonexistent_parameters));
3264 } 3264 }
3265 3265
3266 TEST_F(WebRtcVideoChannel2Test, 3266 TEST_F(WebRtcVideoChannel2Test,
3267 CannotSetRtpParametersWithIncorrectNumberOfEncodings) { 3267 CannotSetRtpParametersWithIncorrectNumberOfEncodings) {
3268 // This test verifies that setting RtpParameters succeeds only if 3268 // This test verifies that setting RtpParameters succeeds only if
3269 // the structure contains exactly one encoding. 3269 // the structure contains exactly one encoding.
3270 // TODO(skvlad): Update this test when we strat supporting setting parameters 3270 // TODO(skvlad): Update this test when we start supporting setting parameters
3271 // for each encoding individually. 3271 // for each encoding individually.
3272 3272
3273 AddSendStream(); 3273 AddSendStream();
3274 // Setting RtpParameters with no encoding is expected to fail. 3274 // Setting RtpParameters with no encoding is expected to fail.
3275 webrtc::RtpParameters parameters; 3275 webrtc::RtpParameters parameters;
3276 EXPECT_FALSE(channel_->SetRtpParameters(last_ssrc_, parameters)); 3276 EXPECT_FALSE(channel_->SetRtpParameters(last_ssrc_, parameters));
3277 // Setting RtpParameters with exactly one encoding should succeed. 3277 // Setting RtpParameters with exactly one encoding should succeed.
3278 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); 3278 parameters.encodings.push_back(webrtc::RtpEncodingParameters());
3279 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters)); 3279 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters));
3280 // Two or more encodings should result in failure. 3280 // Two or more encodings should result in failure.
3281 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); 3281 parameters.encodings.push_back(webrtc::RtpEncodingParameters());
3282 EXPECT_FALSE(channel_->SetRtpParameters(last_ssrc_, parameters)); 3282 EXPECT_FALSE(channel_->SetRtpParameters(last_ssrc_, parameters));
3283 } 3283 }
3284 3284
3285 // Test that a stream will not be sending if its encoding is made
3286 // inactive through SetRtpParameters.
3287 // TODO(deadbeef): Update this test when we start supporting setting parameters
3288 // for each encoding individually.
3289 TEST_F(WebRtcVideoChannel2Test, SetRtpParametersEncodingsActive) {
3290 FakeVideoSendStream* stream = AddSendStream();
3291 EXPECT_TRUE(channel_->SetSend(true));
3292 EXPECT_TRUE(stream->IsSending());
3293
3294 // Get current parameters and change "active" to false.
3295 webrtc::RtpParameters parameters = channel_->GetRtpParameters(last_ssrc_);
3296 ASSERT_EQ(1u, parameters.encodings.size());
3297 ASSERT_TRUE(parameters.encodings[0].active);
3298 parameters.encodings[0].active = false;
3299 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters));
3300 EXPECT_FALSE(stream->IsSending());
3301
3302 // Now change it back to active and verify we resume sending.
3303 parameters.encodings[0].active = true;
3304 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters));
3305 EXPECT_TRUE(stream->IsSending());
3306 }
3307
3285 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration( 3308 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration(
3286 bool receiver_first) { 3309 bool receiver_first) {
3287 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 3310 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
3288 3311
3289 const uint32_t kSenderSsrc = 0xC0FFEE; 3312 const uint32_t kSenderSsrc = 0xC0FFEE;
3290 const uint32_t kSecondSenderSsrc = 0xBADCAFE; 3313 const uint32_t kSecondSenderSsrc = 0xBADCAFE;
3291 const uint32_t kReceiverSsrc = 0x4711; 3314 const uint32_t kReceiverSsrc = 0x4711;
3292 const uint32_t kExpectedDefaultReceiverSsrc = 1; 3315 const uint32_t kExpectedDefaultReceiverSsrc = 1;
3293 3316
3294 if (receiver_first) { 3317 if (receiver_first) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3469 } 3492 }
3470 3493
3471 // Test that we normalize send codec format size in simulcast. 3494 // Test that we normalize send codec format size in simulcast.
3472 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3495 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3473 cricket::VideoCodec codec(kVp8Codec270p); 3496 cricket::VideoCodec codec(kVp8Codec270p);
3474 codec.width += 1; 3497 codec.width += 1;
3475 codec.height += 1; 3498 codec.height += 1;
3476 VerifySimulcastSettings(codec, 2, 2); 3499 VerifySimulcastSettings(codec, 2, 2);
3477 } 3500 }
3478 } // namespace cricket 3501 } // namespace cricket
OLDNEW
« webrtc/media/engine/webrtcvideoengine2.cc ('K') | « webrtc/media/engine/webrtcvideoengine2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698