OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <algorithm> // max | 10 #include <algorithm> // max |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 Clock* const clock_; | 1039 Clock* const clock_; |
1040 std::unique_ptr<internal::TransportAdapter> transport_adapter_; | 1040 std::unique_ptr<internal::TransportAdapter> transport_adapter_; |
1041 rtc::CriticalSection crit_; | 1041 rtc::CriticalSection crit_; |
1042 int64_t last_packet_time_ms_ GUARDED_BY(crit_); | 1042 int64_t last_packet_time_ms_ GUARDED_BY(crit_); |
1043 test::FrameGeneratorCapturer* capturer_ GUARDED_BY(crit_); | 1043 test::FrameGeneratorCapturer* capturer_ GUARDED_BY(crit_); |
1044 } test; | 1044 } test; |
1045 | 1045 |
1046 RunBaseTest(&test); | 1046 RunBaseTest(&test); |
1047 } | 1047 } |
1048 | 1048 |
| 1049 TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) { |
| 1050 const int kCapacityKbps = 10000; // 10 Mbps |
| 1051 class PaddingIsPrimarilyRetransmissions : public test::EndToEndTest { |
| 1052 public: |
| 1053 PaddingIsPrimarilyRetransmissions() |
| 1054 : EndToEndTest(kDefaultTimeoutMs), |
| 1055 clock_(Clock::GetRealTimeClock()), |
| 1056 padding_length_(0), |
| 1057 total_length_(0), |
| 1058 call_(nullptr) {} |
| 1059 |
| 1060 private: |
| 1061 void OnCallsCreated(Call* sender_call, Call* receiver_call) override { |
| 1062 call_ = sender_call; |
| 1063 } |
| 1064 |
| 1065 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
| 1066 rtc::CritScope lock(&crit_); |
| 1067 |
| 1068 RTPHeader header; |
| 1069 parser_->Parse(packet, length, &header); |
| 1070 padding_length_ += header.paddingLength; |
| 1071 total_length_ += length; |
| 1072 return SEND_PACKET; |
| 1073 } |
| 1074 |
| 1075 test::PacketTransport* CreateSendTransport(Call* sender_call) override { |
| 1076 const int kNetworkDelayMs = 50; |
| 1077 FakeNetworkPipe::Config config; |
| 1078 config.loss_percent = 10; |
| 1079 config.link_capacity_kbps = kCapacityKbps; |
| 1080 config.queue_delay_ms = kNetworkDelayMs; |
| 1081 return new test::PacketTransport(sender_call, this, |
| 1082 test::PacketTransport::kSender, config); |
| 1083 } |
| 1084 |
| 1085 void ModifyVideoConfigs( |
| 1086 VideoSendStream::Config* send_config, |
| 1087 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 1088 VideoEncoderConfig* encoder_config) override { |
| 1089 send_config->rtp.extensions.clear(); |
| 1090 send_config->rtp.extensions.push_back( |
| 1091 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
| 1092 test::kTransportSequenceNumberExtensionId)); |
| 1093 // Turn on RTX. |
| 1094 send_config->rtp.rtx.payload_type = kFakeVideoSendPayloadType; |
| 1095 send_config->rtp.rtx.ssrcs.push_back(kVideoSendSsrcs[0]); |
| 1096 |
| 1097 (*receive_configs)[0].rtp.extensions.clear(); |
| 1098 (*receive_configs)[0].rtp.extensions.push_back( |
| 1099 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
| 1100 test::kTransportSequenceNumberExtensionId)); |
| 1101 (*receive_configs)[0].rtp.transport_cc = true; |
| 1102 } |
| 1103 |
| 1104 void PerformTest() override { |
| 1105 // TODO(isheriff): Some platforms do not ramp up as expected to full |
| 1106 // capacity due to packet scheduling delays. Fix that before getting |
| 1107 // rid of this. |
| 1108 SleepMs(5000); |
| 1109 { |
| 1110 rtc::CritScope lock(&crit_); |
| 1111 // Expect padding to be a small percentage of total bytes sent. |
| 1112 EXPECT_LT(padding_length_, .1 * total_length_); |
| 1113 } |
| 1114 } |
| 1115 |
| 1116 rtc::CriticalSection crit_; |
| 1117 Clock* const clock_; |
| 1118 size_t padding_length_ GUARDED_BY(crit_); |
| 1119 size_t total_length_ GUARDED_BY(crit_); |
| 1120 Call* call_; |
| 1121 } test; |
| 1122 |
| 1123 RunBaseTest(&test); |
| 1124 } |
| 1125 |
1049 // This test first observes "high" bitrate use at which point it sends a REMB to | 1126 // This test first observes "high" bitrate use at which point it sends a REMB to |
1050 // indicate that it should be lowered significantly. The test then observes that | 1127 // indicate that it should be lowered significantly. The test then observes that |
1051 // the bitrate observed is sinking well below the min-transmit-bitrate threshold | 1128 // the bitrate observed is sinking well below the min-transmit-bitrate threshold |
1052 // to verify that the min-transmit bitrate respects incoming REMB. | 1129 // to verify that the min-transmit bitrate respects incoming REMB. |
1053 // | 1130 // |
1054 // Note that the test starts at "high" bitrate and does not ramp up to "higher" | 1131 // Note that the test starts at "high" bitrate and does not ramp up to "higher" |
1055 // bitrate since no receiver block or remb is sent in the initial phase. | 1132 // bitrate since no receiver block or remb is sent in the initial phase. |
1056 TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) { | 1133 TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) { |
1057 static const int kMinTransmitBitrateBps = 400000; | 1134 static const int kMinTransmitBitrateBps = 400000; |
1058 static const int kHighBitrateBps = 150000; | 1135 static const int kHighBitrateBps = 150000; |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2803 observation_complete_.Set(); | 2880 observation_complete_.Set(); |
2804 } | 2881 } |
2805 } | 2882 } |
2806 } test; | 2883 } test; |
2807 | 2884 |
2808 RunBaseTest(&test); | 2885 RunBaseTest(&test); |
2809 } | 2886 } |
2810 #endif // !defined(RTC_DISABLE_VP9) | 2887 #endif // !defined(RTC_DISABLE_VP9) |
2811 | 2888 |
2812 } // namespace webrtc | 2889 } // namespace webrtc |
OLD | NEW |