| OLD | NEW |
| 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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 TEST_F(WebRtcVoiceEngineTestFake, | 1034 TEST_F(WebRtcVoiceEngineTestFake, |
| 1035 CannotSetRtpSendParametersWithIncorrectNumberOfEncodings) { | 1035 CannotSetRtpSendParametersWithIncorrectNumberOfEncodings) { |
| 1036 // This test verifies that setting RtpParameters succeeds only if | 1036 // This test verifies that setting RtpParameters succeeds only if |
| 1037 // the structure contains exactly one encoding. | 1037 // the structure contains exactly one encoding. |
| 1038 // TODO(skvlad): Update this test when we start supporting setting parameters | 1038 // TODO(skvlad): Update this test when we start supporting setting parameters |
| 1039 // for each encoding individually. | 1039 // for each encoding individually. |
| 1040 | 1040 |
| 1041 EXPECT_TRUE(SetupSendStream()); | 1041 EXPECT_TRUE(SetupSendStream()); |
| 1042 // Setting RtpParameters with no encoding is expected to fail. | 1042 webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(kSsrc1); |
| 1043 webrtc::RtpParameters parameters; | |
| 1044 EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, parameters)); | |
| 1045 // Setting RtpParameters with exactly one encoding should succeed. | |
| 1046 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); | |
| 1047 EXPECT_TRUE(channel_->SetRtpSendParameters(kSsrc1, parameters)); | |
| 1048 // Two or more encodings should result in failure. | 1043 // Two or more encodings should result in failure. |
| 1049 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); | 1044 parameters.encodings.push_back(webrtc::RtpEncodingParameters()); |
| 1050 EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, parameters)); | 1045 EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, parameters)); |
| 1046 // Zero encodings should also fail. |
| 1047 parameters.encodings.clear(); |
| 1048 EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, parameters)); |
| 1049 } |
| 1050 |
| 1051 // Changing the SSRC through RtpParameters is not allowed. |
| 1052 TEST_F(WebRtcVoiceEngineTestFake, CannotSetSsrcInRtpSendParameters) { |
| 1053 EXPECT_TRUE(SetupSendStream()); |
| 1054 webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(kSsrc1); |
| 1055 parameters.encodings[0].ssrc = rtc::Optional<uint32_t>(0xdeadbeef); |
| 1056 EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, parameters)); |
| 1051 } | 1057 } |
| 1052 | 1058 |
| 1053 // Test that a stream will not be sending if its encoding is made | 1059 // Test that a stream will not be sending if its encoding is made |
| 1054 // inactive through SetRtpSendParameters. | 1060 // inactive through SetRtpSendParameters. |
| 1055 TEST_F(WebRtcVoiceEngineTestFake, SetRtpParametersEncodingsActive) { | 1061 TEST_F(WebRtcVoiceEngineTestFake, SetRtpParametersEncodingsActive) { |
| 1056 EXPECT_TRUE(SetupSendStream()); | 1062 EXPECT_TRUE(SetupSendStream()); |
| 1057 SetSend(true); | 1063 SetSend(true); |
| 1058 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); | 1064 EXPECT_TRUE(GetSendStream(kSsrc1).IsSending()); |
| 1059 // Get current parameters and change "active" to false. | 1065 // Get current parameters and change "active" to false. |
| 1060 webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(kSsrc1); | 1066 webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(kSsrc1); |
| (...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3623 nullptr, webrtc::CreateBuiltinAudioDecoderFactory(), nullptr); | 3629 nullptr, webrtc::CreateBuiltinAudioDecoderFactory(), nullptr); |
| 3624 webrtc::RtcEventLogNullImpl event_log; | 3630 webrtc::RtcEventLogNullImpl event_log; |
| 3625 std::unique_ptr<webrtc::Call> call( | 3631 std::unique_ptr<webrtc::Call> call( |
| 3626 webrtc::Call::Create(webrtc::Call::Config(&event_log))); | 3632 webrtc::Call::Create(webrtc::Call::Config(&event_log))); |
| 3627 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3633 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
| 3628 cricket::AudioOptions(), call.get()); | 3634 cricket::AudioOptions(), call.get()); |
| 3629 cricket::AudioRecvParameters parameters; | 3635 cricket::AudioRecvParameters parameters; |
| 3630 parameters.codecs = engine.recv_codecs(); | 3636 parameters.codecs = engine.recv_codecs(); |
| 3631 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3637 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
| 3632 } | 3638 } |
| OLD | NEW |