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

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

Issue 1885473004: Adding codecs to the RtpParameters returned by an RtpSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Responding to skvlad@ feedback. Created 4 years, 8 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 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after
3386 parameters.encodings[0].active = false; 3386 parameters.encodings[0].active = false;
3387 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters)); 3387 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters));
3388 EXPECT_FALSE(stream->IsSending()); 3388 EXPECT_FALSE(stream->IsSending());
3389 3389
3390 // Now change it back to active and verify we resume sending. 3390 // Now change it back to active and verify we resume sending.
3391 parameters.encodings[0].active = true; 3391 parameters.encodings[0].active = true;
3392 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters)); 3392 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, parameters));
3393 EXPECT_TRUE(stream->IsSending()); 3393 EXPECT_TRUE(stream->IsSending());
3394 } 3394 }
3395 3395
3396 // Test that GetRtpParameters returns the currently configured codecs.
3397 TEST_F(WebRtcVideoChannel2Test, GetRtpParametersCodecs) {
3398 AddSendStream();
3399 cricket::VideoSendParameters parameters;
3400 parameters.codecs.push_back(kVp8Codec);
3401 parameters.codecs.push_back(kVp9Codec);
3402 EXPECT_TRUE(channel_->SetSendParameters(parameters));
3403
3404 webrtc::RtpParameters rtp_parameters = channel_->GetRtpParameters(last_ssrc_);
3405 ASSERT_EQ(2u, rtp_parameters.codecs.size());
3406 EXPECT_EQ(kVp8Codec.id, rtp_parameters.codecs[0].payload_type);
3407 EXPECT_EQ(kVp8Codec.name, rtp_parameters.codecs[0].mime_type);
3408 EXPECT_EQ(kVp8Codec.clockrate, rtp_parameters.codecs[0].clock_rate);
3409 EXPECT_EQ(1, rtp_parameters.codecs[0].channels);
3410 EXPECT_EQ(kVp9Codec.id, rtp_parameters.codecs[1].payload_type);
3411 EXPECT_EQ(kVp9Codec.name, rtp_parameters.codecs[1].mime_type);
3412 EXPECT_EQ(kVp9Codec.clockrate, rtp_parameters.codecs[1].clock_rate);
3413 EXPECT_EQ(1, rtp_parameters.codecs[1].channels);
3414 }
3415
3416 // Test that if we set/get parameters multiple times, we get the same results.
3417 TEST_F(WebRtcVideoChannel2Test, SetAndGetRtpParameters) {
3418 AddSendStream();
3419 cricket::VideoSendParameters parameters;
3420 parameters.codecs.push_back(kVp8Codec);
3421 parameters.codecs.push_back(kVp9Codec);
3422 EXPECT_TRUE(channel_->SetSendParameters(parameters));
3423
3424 webrtc::RtpParameters initial_params = channel_->GetRtpParameters(last_ssrc_);
3425
3426 // We should be able to set the params we just got.
3427 EXPECT_TRUE(channel_->SetRtpParameters(last_ssrc_, initial_params));
3428
3429 // ... And this shouldn't change the params returned by GetRtpParameters.
3430 EXPECT_EQ(initial_params, channel_->GetRtpParameters(last_ssrc_));
3431 }
3432
3396 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration( 3433 void WebRtcVideoChannel2Test::TestReceiverLocalSsrcConfiguration(
3397 bool receiver_first) { 3434 bool receiver_first) {
3398 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_)); 3435 EXPECT_TRUE(channel_->SetSendParameters(send_parameters_));
3399 3436
3400 const uint32_t kSenderSsrc = 0xC0FFEE; 3437 const uint32_t kSenderSsrc = 0xC0FFEE;
3401 const uint32_t kSecondSenderSsrc = 0xBADCAFE; 3438 const uint32_t kSecondSenderSsrc = 0xBADCAFE;
3402 const uint32_t kReceiverSsrc = 0x4711; 3439 const uint32_t kReceiverSsrc = 0x4711;
3403 const uint32_t kExpectedDefaultReceiverSsrc = 1; 3440 const uint32_t kExpectedDefaultReceiverSsrc = 1;
3404 3441
3405 if (receiver_first) { 3442 if (receiver_first) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 } 3617 }
3581 3618
3582 // Test that we normalize send codec format size in simulcast. 3619 // Test that we normalize send codec format size in simulcast.
3583 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) { 3620 TEST_F(WebRtcVideoChannel2SimulcastTest, SetSendCodecsWithOddSizeInSimulcast) {
3584 cricket::VideoCodec codec(kVp8Codec270p); 3621 cricket::VideoCodec codec(kVp8Codec270p);
3585 codec.width += 1; 3622 codec.width += 1;
3586 codec.height += 1; 3623 codec.height += 1;
3587 VerifySimulcastSettings(codec, 2, 2); 3624 VerifySimulcastSettings(codec, 2, 2);
3588 } 3625 }
3589 } // namespace cricket 3626 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698