OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2009 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 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1949 EXPECT_FALSE(media_channel1_->ready_to_send()); | 1949 EXPECT_FALSE(media_channel1_->ready_to_send()); |
1950 } | 1950 } |
1951 | 1951 |
1952 bool SetRemoteContentWithBitrateLimit(int remote_limit) { | 1952 bool SetRemoteContentWithBitrateLimit(int remote_limit) { |
1953 typename T::Content content; | 1953 typename T::Content content; |
1954 CreateContent(0, kPcmuCodec, kH264Codec, &content); | 1954 CreateContent(0, kPcmuCodec, kH264Codec, &content); |
1955 content.set_bandwidth(remote_limit); | 1955 content.set_bandwidth(remote_limit); |
1956 return channel1_->SetRemoteContent(&content, CA_OFFER, NULL); | 1956 return channel1_->SetRemoteContent(&content, CA_OFFER, NULL); |
1957 } | 1957 } |
1958 | 1958 |
1959 webrtc::RtpParameters BitrateLimitedParameters(int limit) { | 1959 webrtc::RtpParameters BitrateLimitedParameters(rtc::Optional<int> limit) { |
1960 webrtc::RtpParameters parameters; | 1960 webrtc::RtpParameters parameters; |
1961 webrtc::RtpEncodingParameters encoding; | 1961 webrtc::RtpEncodingParameters encoding; |
1962 encoding.max_bitrate_bps = limit; | 1962 encoding.max_bitrate_bps = limit; |
1963 parameters.encodings.push_back(encoding); | 1963 parameters.encodings.push_back(encoding); |
1964 return parameters; | 1964 return parameters; |
1965 } | 1965 } |
1966 | 1966 |
1967 void VerifyMaxBitrate(const webrtc::RtpParameters& parameters, | 1967 void VerifyMaxBitrate(const webrtc::RtpParameters& parameters, |
1968 int expected_bitrate) { | 1968 rtc::Optional<int> expected_bitrate) { |
1969 EXPECT_EQ(1UL, parameters.encodings.size()); | 1969 EXPECT_EQ(1UL, parameters.encodings.size()); |
1970 EXPECT_EQ(expected_bitrate, parameters.encodings[0].max_bitrate_bps); | 1970 EXPECT_EQ(expected_bitrate, parameters.encodings[0].max_bitrate_bps); |
1971 } | 1971 } |
1972 | 1972 |
1973 void DefaultMaxBitrateIsUnlimited() { | 1973 void DefaultMaxBitrateIsUnlimited() { |
1974 CreateChannels(0, 0); | 1974 CreateChannels(0, 0); |
1975 EXPECT_TRUE( | 1975 EXPECT_TRUE( |
1976 channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL)); | 1976 channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL)); |
1977 EXPECT_EQ(media_channel1_->max_bps(), -1); | 1977 EXPECT_EQ(media_channel1_->max_bps(), -1); |
1978 VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1), -1); | 1978 VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1), |
| 1979 rtc::Optional<int>()); |
1979 } | 1980 } |
1980 | 1981 |
1981 void CanChangeMaxBitrate() { | 1982 void CanChangeMaxBitrate() { |
1982 CreateChannels(0, 0); | 1983 CreateChannels(0, 0); |
1983 EXPECT_TRUE( | 1984 EXPECT_TRUE( |
1984 channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL)); | 1985 channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL)); |
1985 | 1986 |
1986 EXPECT_TRUE(channel1_->SetRtpSendParameters( | 1987 EXPECT_TRUE(channel1_->SetRtpSendParameters( |
1987 kSsrc1, BitrateLimitedParameters(1000))); | 1988 kSsrc1, BitrateLimitedParameters(rtc::Optional<int>(1000)))); |
1988 VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1), 1000); | 1989 VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1), |
1989 VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1), 1000); | 1990 rtc::Optional<int>(1000)); |
| 1991 VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1), |
| 1992 rtc::Optional<int>(1000)); |
1990 EXPECT_EQ(-1, media_channel1_->max_bps()); | 1993 EXPECT_EQ(-1, media_channel1_->max_bps()); |
1991 | 1994 |
1992 EXPECT_TRUE( | 1995 EXPECT_TRUE(channel1_->SetRtpSendParameters( |
1993 channel1_->SetRtpSendParameters(kSsrc1, BitrateLimitedParameters(-1))); | 1996 kSsrc1, BitrateLimitedParameters(rtc::Optional<int>()))); |
1994 VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1), -1); | 1997 VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1), |
1995 VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1), -1); | 1998 rtc::Optional<int>()); |
| 1999 VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1), |
| 2000 rtc::Optional<int>()); |
1996 EXPECT_EQ(-1, media_channel1_->max_bps()); | 2001 EXPECT_EQ(-1, media_channel1_->max_bps()); |
1997 } | 2002 } |
1998 | 2003 |
1999 protected: | 2004 protected: |
2000 void WaitForThreads() { WaitForThreads(rtc::ArrayView<rtc::Thread*>()); } | 2005 void WaitForThreads() { WaitForThreads(rtc::ArrayView<rtc::Thread*>()); } |
2001 static void ProcessThreadQueue(rtc::Thread* thread) { | 2006 static void ProcessThreadQueue(rtc::Thread* thread) { |
2002 RTC_DCHECK(thread->IsCurrent()); | 2007 RTC_DCHECK(thread->IsCurrent()); |
2003 while (!thread->empty()) { | 2008 while (!thread->empty()) { |
2004 thread->ProcessMessages(0); | 2009 thread->ProcessMessages(0); |
2005 } | 2010 } |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3774 ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_, | 3779 ASSERT_TRUE(voice_channel_.Init_w(nullptr, nullptr, &fake_rtp_dtls_transport_, |
3775 &fake_rtcp_dtls_transport_)); | 3780 &fake_rtcp_dtls_transport_)); |
3776 EXPECT_DEATH(voice_channel_.SetTransports(&fake_rtp_dtls_transport_, | 3781 EXPECT_DEATH(voice_channel_.SetTransports(&fake_rtp_dtls_transport_, |
3777 &fake_rtp_dtls_transport_), | 3782 &fake_rtp_dtls_transport_), |
3778 ""); | 3783 ""); |
3779 } | 3784 } |
3780 | 3785 |
3781 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 3786 #endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
3782 | 3787 |
3783 // TODO(pthatcher): TestSetReceiver? | 3788 // TODO(pthatcher): TestSetReceiver? |
OLD | NEW |