Chromium Code Reviews| Index: webrtc/api/webrtcsession_unittest.cc |
| diff --git a/webrtc/api/webrtcsession_unittest.cc b/webrtc/api/webrtcsession_unittest.cc |
| index 8062fe5db75f7cbc56f58741114da65f9ece5f87..269d9425d25f8ba035f73dc4e11c45f7e617a591 100644 |
| --- a/webrtc/api/webrtcsession_unittest.cc |
| +++ b/webrtc/api/webrtcsession_unittest.cc |
| @@ -3333,6 +3333,36 @@ TEST_F(WebRtcSessionTest, SetAudioPlayout) { |
| EXPECT_EQ(1, volume); |
| } |
| +TEST_F(WebRtcSessionTest, SetAudioMaxSendBitrate) { |
| + Init(); |
| + SendAudioVideoStream1(); |
| + CreateAndSetRemoteOfferAndLocalAnswer(); |
| + cricket::FakeVoiceMediaChannel* channel = media_engine_->GetVoiceChannel(0); |
| + ASSERT_TRUE(channel != NULL); |
| + uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); |
| + EXPECT_EQ(-1, channel->max_bps()); |
| + webrtc::RTCRtpParameters params = session_->GetAudioRtpParameters(send_ssrc); |
| + EXPECT_EQ(1, params.encodings.size()); |
| + EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps); |
| + params.encodings[0].max_bitrate_bps = 1000; |
| + EXPECT_TRUE(session_->SetAudioRtpParameters(send_ssrc, params)); |
| + |
| + // Verify that the media channel received the new parameters |
|
Taylor Brandstetter
2016/03/12 01:57:06
nit: Add periods at the end of comments like this.
skvlad
2016/03/15 21:18:18
Done.
|
| + params = channel->GetRtpParameters(send_ssrc); |
| + EXPECT_EQ(1, params.encodings.size()); |
| + EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); |
| + |
| + // Verify that reading back the parameters returns the same |
| + // value as what has been set previously |
| + params = session_->GetAudioRtpParameters(send_ssrc); |
| + EXPECT_EQ(1, params.encodings.size()); |
| + EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); |
| + |
| + // Verify that the global bitrate limit (coming from SDP) has |
| + // not been changed |
| + EXPECT_EQ(-1, channel->max_bps()); |
| +} |
| + |
| TEST_F(WebRtcSessionTest, SetAudioSend) { |
| Init(); |
| SendAudioVideoStream1(); |
| @@ -3399,6 +3429,34 @@ TEST_F(WebRtcSessionTest, SetVideoPlayout) { |
| EXPECT_TRUE(channel->sinks().begin()->second == NULL); |
| } |
| +TEST_F(WebRtcSessionTest, SetVideoMaxSendBitrate) { |
| + Init(); |
| + SendAudioVideoStream1(); |
| + CreateAndSetRemoteOfferAndLocalAnswer(); |
| + cricket::FakeVideoMediaChannel* channel = media_engine_->GetVideoChannel(0); |
| + ASSERT_TRUE(channel != NULL); |
| + uint32_t send_ssrc = channel->send_streams()[0].first_ssrc(); |
| + EXPECT_EQ(-1, channel->max_bps()); |
| + webrtc::RTCRtpParameters params = session_->GetVideoRtpParameters(send_ssrc); |
| + EXPECT_EQ(1, params.encodings.size()); |
| + EXPECT_EQ(-1, params.encodings[0].max_bitrate_bps); |
| + params.encodings[0].max_bitrate_bps = 1000; |
| + EXPECT_TRUE(session_->SetVideoRtpParameters(send_ssrc, params)); |
| + |
| + // Read back the parameters and verify they have been changed |
| + params = session_->GetVideoRtpParameters(send_ssrc); |
| + EXPECT_EQ(1, params.encodings.size()); |
| + EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); |
| + |
| + // Verify that the video channel received the new parameters |
| + params = channel->GetRtpParameters(send_ssrc); |
| + EXPECT_EQ(1, params.encodings.size()); |
| + EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps); |
| + |
| + // Verify that the global bitrate limit has not been changed |
| + EXPECT_EQ(-1, channel->max_bps()); |
| +} |
| + |
| TEST_F(WebRtcSessionTest, SetVideoSend) { |
| Init(); |
| SendAudioVideoStream1(); |