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

Unified Diff: webrtc/pc/channel_unittest.cc

Issue 1788583004: Enable setting the maximum bitrate limit in RtpSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased on top of the latest master branch Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/pc/channel.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/channel_unittest.cc
diff --git a/webrtc/pc/channel_unittest.cc b/webrtc/pc/channel_unittest.cc
index 7b4a31a1b348974663580509e00a90ff75d406b8..3752db1f55ae81161a3ea41e31e632a8ece715d7 100644
--- a/webrtc/pc/channel_unittest.cc
+++ b/webrtc/pc/channel_unittest.cc
@@ -1769,6 +1769,53 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
EXPECT_FALSE(media_channel1_->ready_to_send());
}
+ bool SetRemoteContentWithBitrateLimit(int remote_limit) {
+ typename T::Content content;
+ CreateContent(0, kPcmuCodec, kH264Codec, &content);
+ content.set_bandwidth(remote_limit);
+ return channel1_->SetRemoteContent(&content, CA_OFFER, NULL);
+ }
+
+ webrtc::RtpParameters BitrateLimitedParameters(int limit) {
+ webrtc::RtpParameters parameters;
+ webrtc::RtpEncodingParameters encoding;
+ encoding.max_bitrate_bps = limit;
+ parameters.encodings.push_back(encoding);
+ return parameters;
+ }
+
+ void VerifyMaxBitrate(const webrtc::RtpParameters& parameters,
+ int expected_bitrate) {
+ EXPECT_EQ(1UL, parameters.encodings.size());
+ EXPECT_EQ(expected_bitrate, parameters.encodings[0].max_bitrate_bps);
+ }
+
+ void DefaultMaxBitrateIsUnlimited() {
+ CreateChannels(0, 0);
+ EXPECT_TRUE(
+ channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL));
+ EXPECT_EQ(media_channel1_->max_bps(), -1);
+ VerifyMaxBitrate(media_channel1_->GetRtpParameters(kSsrc1), -1);
+ }
+
+ void CanChangeMaxBitrate() {
+ CreateChannels(0, 0);
+ EXPECT_TRUE(
+ channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL));
+
+ EXPECT_TRUE(
+ channel1_->SetRtpParameters(kSsrc1, BitrateLimitedParameters(1000)));
+ VerifyMaxBitrate(channel1_->GetRtpParameters(kSsrc1), 1000);
+ VerifyMaxBitrate(media_channel1_->GetRtpParameters(kSsrc1), 1000);
+ EXPECT_EQ(-1, media_channel1_->max_bps());
+
+ EXPECT_TRUE(
+ channel1_->SetRtpParameters(kSsrc1, BitrateLimitedParameters(-1)));
+ VerifyMaxBitrate(channel1_->GetRtpParameters(kSsrc1), -1);
+ VerifyMaxBitrate(media_channel1_->GetRtpParameters(kSsrc1), -1);
+ EXPECT_EQ(-1, media_channel1_->max_bps());
+ }
+
protected:
// TODO(pbos): Remove playout from all media channels and let renderers mute
// themselves.
@@ -2229,6 +2276,26 @@ TEST_F(VoiceChannelTest, SendBundleToBundleWithRtcpMuxSecure) {
Base::SendBundleToBundle(kAudioPts, arraysize(kAudioPts), true, true);
}
+TEST_F(VoiceChannelTest, GetRtpParametersIsNotImplemented) {
+ // These tests verify that the Get/SetRtpParameters methods for VoiceChannel
+ // always fail as they are not implemented.
+ // TODO(skvlad): Replace with full tests when support for bitrate limiting
+ // for audio RtpSenders is added.
+ CreateChannels(0, 0);
+ EXPECT_TRUE(
+ channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL));
+ webrtc::RtpParameters voice_parameters = channel1_->GetRtpParameters(kSsrc1);
+ EXPECT_EQ(0UL, voice_parameters.encodings.size());
+}
+
+TEST_F(VoiceChannelTest, SetRtpParametersIsNotImplemented) {
+ CreateChannels(0, 0);
+ EXPECT_TRUE(
+ channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL));
+ EXPECT_FALSE(
+ channel1_->SetRtpParameters(kSsrc1, BitrateLimitedParameters(1000)));
+}
+
// VideoChannelTest
TEST_F(VideoChannelTest, TestInit) {
Base::TestInit();
@@ -2457,6 +2524,14 @@ TEST_F(VideoChannelTest, TestOnReadyToSendWithRtcpMux) {
Base::TestOnReadyToSendWithRtcpMux();
}
+TEST_F(VideoChannelTest, DefaultMaxBitrateIsUnlimited) {
+ Base::DefaultMaxBitrateIsUnlimited();
+}
+
+TEST_F(VideoChannelTest, CanChangeMaxBitrate) {
+ Base::CanChangeMaxBitrate();
+}
+
// DataChannelTest
class DataChannelTest
« no previous file with comments | « webrtc/pc/channel.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698