Chromium Code Reviews| 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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 903 EXPECT_EQ(64000, GetCodecBitrate(kSsrcs4[2])); | 903 EXPECT_EQ(64000, GetCodecBitrate(kSsrcs4[2])); |
| 904 | 904 |
| 905 // Remove the global cap; the streams should switch to their respective | 905 // Remove the global cap; the streams should switch to their respective |
| 906 // maximums (or remain unchanged if there was no other limit on them.) | 906 // maximums (or remain unchanged if there was no other limit on them.) |
| 907 EXPECT_TRUE(SetGlobalMaxBitrate(kOpusCodec, -1)); | 907 EXPECT_TRUE(SetGlobalMaxBitrate(kOpusCodec, -1)); |
| 908 EXPECT_EQ(48000, GetCodecBitrate(kSsrcs4[0])); | 908 EXPECT_EQ(48000, GetCodecBitrate(kSsrcs4[0])); |
| 909 EXPECT_EQ(96000, GetCodecBitrate(kSsrcs4[1])); | 909 EXPECT_EQ(96000, GetCodecBitrate(kSsrcs4[1])); |
| 910 EXPECT_EQ(64000, GetCodecBitrate(kSsrcs4[2])); | 910 EXPECT_EQ(64000, GetCodecBitrate(kSsrcs4[2])); |
| 911 } | 911 } |
| 912 | 912 |
| 913 // Test that GetRtpParameters returns the currently configured codecs. | |
| 914 TEST_F(WebRtcVoiceEngineTestFake, GetRtpParametersCodecs) { | |
| 915 EXPECT_TRUE(SetupSendStream()); | |
| 916 cricket::AudioSendParameters parameters; | |
| 917 parameters.codecs.push_back(kIsacCodec); | |
| 918 parameters.codecs.push_back(kPcmuCodec); | |
| 919 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | |
| 920 | |
| 921 webrtc::RtpParameters rtp_parameters = channel_->GetRtpParameters(kSsrc1); | |
| 922 ASSERT_EQ(2u, rtp_parameters.codecs.size()); | |
| 923 EXPECT_EQ(kIsacCodec.id, rtp_parameters.codecs[0].payload_type); | |
| 924 EXPECT_EQ(kIsacCodec.name, rtp_parameters.codecs[0].mime_type); | |
| 925 EXPECT_EQ(kIsacCodec.clockrate, rtp_parameters.codecs[0].clock_rate); | |
| 926 EXPECT_EQ(kIsacCodec.channels, rtp_parameters.codecs[0].channels); | |
| 927 EXPECT_EQ(kPcmuCodec.id, rtp_parameters.codecs[1].payload_type); | |
| 928 EXPECT_EQ(kPcmuCodec.name, rtp_parameters.codecs[1].mime_type); | |
| 929 EXPECT_EQ(kPcmuCodec.clockrate, rtp_parameters.codecs[1].clock_rate); | |
| 930 EXPECT_EQ(kPcmuCodec.channels, rtp_parameters.codecs[1].channels); | |
|
pthatcher1
2016/04/14 15:58:12
Since you implemented the == operator, you could j
Taylor Brandstetter
2016/04/14 16:30:54
I didn't implement the == operator for webrtc::Rtp
| |
| 931 } | |
| 932 | |
| 933 // Test that if we set/get parameters multiple times, we get the same results. | |
| 934 TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpParameters) { | |
| 935 EXPECT_TRUE(SetupSendStream()); | |
| 936 cricket::AudioSendParameters parameters; | |
| 937 parameters.codecs.push_back(kIsacCodec); | |
| 938 parameters.codecs.push_back(kPcmuCodec); | |
| 939 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | |
| 940 | |
| 941 webrtc::RtpParameters initial_params = channel_->GetRtpParameters(kSsrc1); | |
| 942 | |
| 943 // We should be able to set the params we just got. | |
| 944 EXPECT_TRUE(channel_->SetRtpParameters(kSsrc1, initial_params)); | |
| 945 | |
| 946 // ... And this shouldn't change the params returned by GetRtpParameters. | |
| 947 webrtc::RtpParameters new_params = channel_->GetRtpParameters(kSsrc1); | |
| 948 EXPECT_EQ(initial_params, channel_->GetRtpParameters(kSsrc1)); | |
| 949 } | |
| 950 | |
| 913 // Test that we apply codecs properly. | 951 // Test that we apply codecs properly. |
| 914 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecs) { | 952 TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecs) { |
| 915 EXPECT_TRUE(SetupSendStream()); | 953 EXPECT_TRUE(SetupSendStream()); |
| 916 cricket::AudioSendParameters parameters; | 954 cricket::AudioSendParameters parameters; |
| 917 parameters.codecs.push_back(kIsacCodec); | 955 parameters.codecs.push_back(kIsacCodec); |
| 918 parameters.codecs.push_back(kPcmuCodec); | 956 parameters.codecs.push_back(kPcmuCodec); |
| 919 parameters.codecs.push_back(kRedCodec); | 957 parameters.codecs.push_back(kRedCodec); |
| 920 parameters.codecs[0].id = 96; | 958 parameters.codecs[0].id = 96; |
| 921 parameters.codecs[0].bitrate = 48000; | 959 parameters.codecs[0].bitrate = 48000; |
| 922 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 960 EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
| (...skipping 2570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3493 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { | 3531 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { |
| 3494 cricket::WebRtcVoiceEngine engine(nullptr); | 3532 cricket::WebRtcVoiceEngine engine(nullptr); |
| 3495 std::unique_ptr<webrtc::Call> call( | 3533 std::unique_ptr<webrtc::Call> call( |
| 3496 webrtc::Call::Create(webrtc::Call::Config())); | 3534 webrtc::Call::Create(webrtc::Call::Config())); |
| 3497 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3535 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
| 3498 cricket::AudioOptions(), call.get()); | 3536 cricket::AudioOptions(), call.get()); |
| 3499 cricket::AudioRecvParameters parameters; | 3537 cricket::AudioRecvParameters parameters; |
| 3500 parameters.codecs = engine.codecs(); | 3538 parameters.codecs = engine.codecs(); |
| 3501 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3539 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
| 3502 } | 3540 } |
| OLD | NEW |