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

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

Issue 1943073003: Support RtpEncodingParameters::active in voice engine. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Using DCHECK_EQ Created 4 years, 7 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/webrtcvoiceengine.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) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 webrtc::RtpParameters parameters; 886 webrtc::RtpParameters parameters;
887 EXPECT_FALSE(channel_->SetRtpParameters(kSsrc1, parameters)); 887 EXPECT_FALSE(channel_->SetRtpParameters(kSsrc1, parameters));
888 // Setting RtpParameters with exactly one encoding should succeed. 888 // Setting RtpParameters with exactly one encoding should succeed.
889 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); 889 parameters.encodings.push_back(webrtc::RtpEncodingParameters());
890 EXPECT_TRUE(channel_->SetRtpParameters(kSsrc1, parameters)); 890 EXPECT_TRUE(channel_->SetRtpParameters(kSsrc1, parameters));
891 // Two or more encodings should result in failure. 891 // Two or more encodings should result in failure.
892 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); 892 parameters.encodings.push_back(webrtc::RtpEncodingParameters());
893 EXPECT_FALSE(channel_->SetRtpParameters(kSsrc1, parameters)); 893 EXPECT_FALSE(channel_->SetRtpParameters(kSsrc1, parameters));
894 } 894 }
895 895
896 // Test that a stream will not be sending if its encoding is made
897 // inactive through SetRtpParameters.
898 TEST_F(WebRtcVoiceEngineTestFake, SetRtpParametersEncodingsActive) {
899 EXPECT_TRUE(SetupSendStream());
900 SetSend(channel_, true);
901 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending());
902 // Get current parameters and change "active" to false.
903 webrtc::RtpParameters parameters = channel_->GetRtpParameters(kSsrc1);
904 ASSERT_EQ(1u, parameters.encodings.size());
905 ASSERT_TRUE(parameters.encodings[0].active);
906 parameters.encodings[0].active = false;
907 EXPECT_TRUE(channel_->SetRtpParameters(kSsrc1, parameters));
908 EXPECT_FALSE(GetSendStream(kSsrc1).IsSending());
909
910 // Now change it back to active and verify we resume sending.
911 parameters.encodings[0].active = true;
912 EXPECT_TRUE(channel_->SetRtpParameters(kSsrc1, parameters));
913 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending());
914 }
915
896 // Test that SetRtpParameters configures the correct encoding channel for each 916 // Test that SetRtpParameters configures the correct encoding channel for each
897 // SSRC. 917 // SSRC.
898 TEST_F(WebRtcVoiceEngineTestFake, RtpParametersArePerStream) { 918 TEST_F(WebRtcVoiceEngineTestFake, RtpParametersArePerStream) {
899 SetupForMultiSendStream(); 919 SetupForMultiSendStream();
900 // Create send streams. 920 // Create send streams.
901 for (uint32_t ssrc : kSsrcs4) { 921 for (uint32_t ssrc : kSsrcs4) {
902 EXPECT_TRUE( 922 EXPECT_TRUE(
903 channel_->AddSendStream(cricket::StreamParams::CreateLegacy(ssrc))); 923 channel_->AddSendStream(cricket::StreamParams::CreateLegacy(ssrc)));
904 } 924 }
905 // Configure one stream to be limited by the stream config, another to be 925 // Configure one stream to be limited by the stream config, another to be
(...skipping 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3568 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { 3588 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) {
3569 cricket::WebRtcVoiceEngine engine(nullptr); 3589 cricket::WebRtcVoiceEngine engine(nullptr);
3570 std::unique_ptr<webrtc::Call> call( 3590 std::unique_ptr<webrtc::Call> call(
3571 webrtc::Call::Create(webrtc::Call::Config())); 3591 webrtc::Call::Create(webrtc::Call::Config()));
3572 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3592 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3573 cricket::AudioOptions(), call.get()); 3593 cricket::AudioOptions(), call.get());
3574 cricket::AudioRecvParameters parameters; 3594 cricket::AudioRecvParameters parameters;
3575 parameters.codecs = engine.codecs(); 3595 parameters.codecs = engine.codecs();
3576 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3596 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3577 } 3597 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698