Index: webrtc/media/engine/webrtcvoiceengine_unittest.cc |
diff --git a/webrtc/media/engine/webrtcvoiceengine_unittest.cc b/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
index 9f9ab47242df5f784e6926cac4862c1f035a699d..67334277ef43415fc31f05e123db5d1ee06b263e 100644 |
--- a/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
+++ b/webrtc/media/engine/webrtcvoiceengine_unittest.cc |
@@ -235,11 +235,11 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
// Sets the per-stream maximum bitrate limit for the specified SSRC. |
bool SetMaxBitrateForStream(int32_t ssrc, int bitrate) { |
- webrtc::RtpParameters parameters = channel_->GetRtpParameters(ssrc); |
+ webrtc::RtpParameters parameters = channel_->GetRtpSendParameters(ssrc); |
EXPECT_EQ(1UL, parameters.encodings.size()); |
parameters.encodings[0].max_bitrate_bps = bitrate; |
- return channel_->SetRtpParameters(ssrc, parameters); |
+ return channel_->SetRtpSendParameters(ssrc, parameters); |
} |
bool SetGlobalMaxBitrate(const cricket::AudioCodec& codec, int bitrate) { |
@@ -274,7 +274,7 @@ class WebRtcVoiceEngineTestFake : public testing::Test { |
// Verify that reading back the parameters gives results |
// consistent with the Set() result. |
webrtc::RtpParameters resulting_parameters = |
- channel_->GetRtpParameters(kSsrc1); |
+ channel_->GetRtpSendParameters(kSsrc1); |
EXPECT_EQ(1UL, resulting_parameters.encodings.size()); |
EXPECT_EQ(expected_result ? stream_max : -1, |
resulting_parameters.encodings[0].max_bitrate_bps); |
@@ -867,15 +867,15 @@ TEST_F(WebRtcVoiceEngineTestFake, SetMaxBitratePerStream) { |
TEST_F(WebRtcVoiceEngineTestFake, CannotSetMaxBitrateForNonexistentStream) { |
EXPECT_TRUE(SetupChannel()); |
webrtc::RtpParameters nonexistent_parameters = |
- channel_->GetRtpParameters(kSsrc1); |
+ channel_->GetRtpSendParameters(kSsrc1); |
EXPECT_EQ(0, nonexistent_parameters.encodings.size()); |
nonexistent_parameters.encodings.push_back(webrtc::RtpEncodingParameters()); |
- EXPECT_FALSE(channel_->SetRtpParameters(kSsrc1, nonexistent_parameters)); |
+ EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, nonexistent_parameters)); |
} |
TEST_F(WebRtcVoiceEngineTestFake, |
- CannotSetRtpParametersWithIncorrectNumberOfEncodings) { |
+ CannotSetRtpSendParametersWithIncorrectNumberOfEncodings) { |
// This test verifies that setting RtpParameters succeeds only if |
// the structure contains exactly one encoding. |
// TODO(skvlad): Update this test when we start supporting setting parameters |
@@ -884,16 +884,17 @@ TEST_F(WebRtcVoiceEngineTestFake, |
EXPECT_TRUE(SetupSendStream()); |
// Setting RtpParameters with no encoding is expected to fail. |
webrtc::RtpParameters parameters; |
- EXPECT_FALSE(channel_->SetRtpParameters(kSsrc1, parameters)); |
+ EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, parameters)); |
// Setting RtpParameters with exactly one encoding should succeed. |
parameters.encodings.push_back(webrtc::RtpEncodingParameters()); |
- EXPECT_TRUE(channel_->SetRtpParameters(kSsrc1, parameters)); |
+ EXPECT_TRUE(channel_->SetRtpSendParameters(kSsrc1, parameters)); |
// Two or more encodings should result in failure. |
parameters.encodings.push_back(webrtc::RtpEncodingParameters()); |
- EXPECT_FALSE(channel_->SetRtpParameters(kSsrc1, parameters)); |
+ EXPECT_FALSE(channel_->SetRtpSendParameters(kSsrc1, parameters)); |
} |
-// Test that SetRtpParameters configures the correct encoding channel for each |
+// Test that SetRtpSendParameters configures the correct encoding channel for |
+// each |
// SSRC. |
TEST_F(WebRtcVoiceEngineTestFake, RtpParametersArePerStream) { |
SetupForMultiSendStream(); |
@@ -922,42 +923,71 @@ TEST_F(WebRtcVoiceEngineTestFake, RtpParametersArePerStream) { |
EXPECT_EQ(64000, GetCodecBitrate(kSsrcs4[2])); |
} |
-// Test that GetRtpParameters returns the currently configured codecs. |
-TEST_F(WebRtcVoiceEngineTestFake, GetRtpParametersCodecs) { |
+// Test that GetRtpSendParameters returns the currently configured codecs. |
+TEST_F(WebRtcVoiceEngineTestFake, GetRtpSendParametersCodecs) { |
EXPECT_TRUE(SetupSendStream()); |
cricket::AudioSendParameters parameters; |
parameters.codecs.push_back(kIsacCodec); |
parameters.codecs.push_back(kPcmuCodec); |
EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
- webrtc::RtpParameters rtp_parameters = channel_->GetRtpParameters(kSsrc1); |
+ webrtc::RtpParameters rtp_parameters = channel_->GetRtpSendParameters(kSsrc1); |
ASSERT_EQ(2u, rtp_parameters.codecs.size()); |
- EXPECT_EQ(kIsacCodec.id, rtp_parameters.codecs[0].payload_type); |
- EXPECT_EQ(kIsacCodec.name, rtp_parameters.codecs[0].mime_type); |
- EXPECT_EQ(kIsacCodec.clockrate, rtp_parameters.codecs[0].clock_rate); |
- EXPECT_EQ(kIsacCodec.channels, rtp_parameters.codecs[0].channels); |
- EXPECT_EQ(kPcmuCodec.id, rtp_parameters.codecs[1].payload_type); |
- EXPECT_EQ(kPcmuCodec.name, rtp_parameters.codecs[1].mime_type); |
- EXPECT_EQ(kPcmuCodec.clockrate, rtp_parameters.codecs[1].clock_rate); |
- EXPECT_EQ(kPcmuCodec.channels, rtp_parameters.codecs[1].channels); |
+ EXPECT_EQ(kIsacCodec.ToCodecParameters(), rtp_parameters.codecs[0]); |
+ EXPECT_EQ(kPcmuCodec.ToCodecParameters(), rtp_parameters.codecs[1]); |
} |
// Test that if we set/get parameters multiple times, we get the same results. |
-TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpParameters) { |
+TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpSendParameters) { |
EXPECT_TRUE(SetupSendStream()); |
cricket::AudioSendParameters parameters; |
parameters.codecs.push_back(kIsacCodec); |
parameters.codecs.push_back(kPcmuCodec); |
EXPECT_TRUE(channel_->SetSendParameters(parameters)); |
- webrtc::RtpParameters initial_params = channel_->GetRtpParameters(kSsrc1); |
+ webrtc::RtpParameters initial_params = channel_->GetRtpSendParameters(kSsrc1); |
// We should be able to set the params we just got. |
- EXPECT_TRUE(channel_->SetRtpParameters(kSsrc1, initial_params)); |
+ EXPECT_TRUE(channel_->SetRtpSendParameters(kSsrc1, initial_params)); |
- // ... And this shouldn't change the params returned by GetRtpParameters. |
- webrtc::RtpParameters new_params = channel_->GetRtpParameters(kSsrc1); |
- EXPECT_EQ(initial_params, channel_->GetRtpParameters(kSsrc1)); |
+ // ... And this shouldn't change the params returned by GetRtpSendParameters. |
+ webrtc::RtpParameters new_params = channel_->GetRtpSendParameters(kSsrc1); |
+ EXPECT_EQ(initial_params, channel_->GetRtpSendParameters(kSsrc1)); |
+} |
+ |
+// Test that GetRtpReceiveParameters returns the currently configured codecs. |
+TEST_F(WebRtcVoiceEngineTestFake, GetRtpReceiveParametersCodecs) { |
+ EXPECT_TRUE(SetupRecvStream()); |
+ cricket::AudioRecvParameters parameters; |
+ parameters.codecs.push_back(kIsacCodec); |
+ parameters.codecs.push_back(kPcmuCodec); |
+ EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
+ |
+ webrtc::RtpParameters rtp_parameters = |
+ channel_->GetRtpReceiveParameters(kSsrc1); |
+ ASSERT_EQ(2u, rtp_parameters.codecs.size()); |
+ EXPECT_EQ(kIsacCodec.ToCodecParameters(), rtp_parameters.codecs[0]); |
+ EXPECT_EQ(kPcmuCodec.ToCodecParameters(), rtp_parameters.codecs[1]); |
+} |
+ |
+// Test that if we set/get parameters multiple times, we get the same results. |
+TEST_F(WebRtcVoiceEngineTestFake, SetAndGetRtpReceiveParameters) { |
+ EXPECT_TRUE(SetupRecvStream()); |
+ cricket::AudioRecvParameters parameters; |
+ parameters.codecs.push_back(kIsacCodec); |
+ parameters.codecs.push_back(kPcmuCodec); |
+ EXPECT_TRUE(channel_->SetRecvParameters(parameters)); |
+ |
+ webrtc::RtpParameters initial_params = |
+ channel_->GetRtpReceiveParameters(kSsrc1); |
+ |
+ // We should be able to set the params we just got. |
+ EXPECT_TRUE(channel_->SetRtpReceiveParameters(kSsrc1, initial_params)); |
+ |
+ // ... And this shouldn't change the params returned by |
+ // GetRtpReceiveParameters. |
+ webrtc::RtpParameters new_params = channel_->GetRtpReceiveParameters(kSsrc1); |
+ EXPECT_EQ(initial_params, channel_->GetRtpReceiveParameters(kSsrc1)); |
} |
// Test that we apply codecs properly. |