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

Side by Side Diff: webrtc/video/video_send_stream_tests.cc

Issue 2347023002: BitrateProber: Support higher probing bitrates (Closed)
Patch Set: Fix thread race and test flakiness on some platforms Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 Clock* const clock_; 1037 Clock* const clock_;
1038 std::unique_ptr<internal::TransportAdapter> transport_adapter_; 1038 std::unique_ptr<internal::TransportAdapter> transport_adapter_;
1039 rtc::CriticalSection crit_; 1039 rtc::CriticalSection crit_;
1040 int64_t last_packet_time_ms_ GUARDED_BY(crit_); 1040 int64_t last_packet_time_ms_ GUARDED_BY(crit_);
1041 test::FrameGeneratorCapturer* capturer_ GUARDED_BY(crit_); 1041 test::FrameGeneratorCapturer* capturer_ GUARDED_BY(crit_);
1042 } test; 1042 } test;
1043 1043
1044 RunBaseTest(&test); 1044 RunBaseTest(&test);
1045 } 1045 }
1046 1046
1047 TEST_F(VideoSendStreamTest, PaddingIsPrimarilyRetransmissions) {
1048 const int kCapacityKbps = 10000; // 10 Mbps
1049 class PaddingIsPrimarilyRetransmissions : public test::EndToEndTest {
1050 public:
1051 PaddingIsPrimarilyRetransmissions()
1052 : EndToEndTest(kDefaultTimeoutMs),
1053 clock_(Clock::GetRealTimeClock()),
1054 padding_length_(0),
1055 total_length_(0),
1056 call_(nullptr) {}
1057
1058 private:
1059 void OnCallsCreated(Call* sender_call, Call* receiver_call) override {
1060 call_ = sender_call;
1061 }
1062
1063 Action OnSendRtp(const uint8_t* packet, size_t length) override {
1064 rtc::CritScope lock(&crit_);
1065
1066 RTPHeader header;
1067 parser_->Parse(packet, length, &header);
1068 padding_length_ += header.paddingLength;
stefan-webrtc 2016/09/30 08:37:21 You only have to protect padding_length_ and total
Irfan 2016/10/03 18:45:26 Right, but given the contention is a one time thin
stefan-webrtc 2016/10/04 14:56:40 Acknowledged.
1069 total_length_ += length;
1070 return SEND_PACKET;
1071 }
1072
1073 test::PacketTransport* CreateSendTransport(Call* sender_call) override {
1074 const int kNetworkDelayMs = 50;
1075 FakeNetworkPipe::Config config;
1076 config.loss_percent = 10;
1077 config.link_capacity_kbps = kCapacityKbps;
1078 config.queue_delay_ms = kNetworkDelayMs;
1079 return new test::PacketTransport(sender_call, this,
1080 test::PacketTransport::kSender, config);
1081 }
1082
1083 void ModifyVideoConfigs(
1084 VideoSendStream::Config* send_config,
1085 std::vector<VideoReceiveStream::Config>* receive_configs,
1086 VideoEncoderConfig* encoder_config) override {
1087 send_config->rtp.extensions.clear();
1088 send_config->rtp.extensions.push_back(
1089 RtpExtension(RtpExtension::kTransportSequenceNumberUri,
1090 test::kTransportSequenceNumberExtensionId));
1091 // Turn on RTX
stefan-webrtc 2016/09/30 08:37:21 End with .
Irfan 2016/10/03 18:45:26 Done.
1092 send_config->rtp.rtx.payload_type = kFakeVideoSendPayloadType;
1093 send_config->rtp.rtx.ssrcs.push_back(kVideoSendSsrcs[0]);
1094
1095 (*receive_configs)[0].rtp.extensions.clear();
1096 (*receive_configs)[0].rtp.extensions.push_back(
1097 RtpExtension(RtpExtension::kTransportSequenceNumberUri,
1098 test::kTransportSequenceNumberExtensionId));
1099 (*receive_configs)[0].rtp.transport_cc = true;
1100 }
1101
1102 void PerformTest() override {
1103 // TODO(isheriff): Some platforms do not ramp up as expected to full
1104 // capacity due to packet scheduling delays. Fix that before getting
1105 // rid of this.
1106 SleepMs(5000);
1107 {
1108 rtc::CritScope lock(&crit_);
1109 // Expect padding to be a small percentage of total bytes sent.
1110 EXPECT_LT(padding_length_, .1 * total_length_);
stefan-webrtc 2016/09/30 08:37:21 Just a question: I would have expected 0% padding.
Irfan 2016/10/03 18:45:26 Adding logs, I see that there are a small number o
stefan-webrtc 2016/10/04 14:56:40 Out of curiosity, are those sent before any media
Irfan 2016/10/04 15:23:33 Clarification here: Turns out, its actually becaus
1111 }
1112 }
1113
1114 rtc::CriticalSection crit_;
1115 Clock* const clock_;
1116 size_t padding_length_;
1117 size_t total_length_;
stefan-webrtc 2016/09/30 08:37:21 Add GUARDED_BY
Irfan 2016/10/03 18:45:26 Done.
1118 Call* call_;
1119 } test;
1120
1121 RunBaseTest(&test);
1122 }
1123
1047 // This test first observes "high" bitrate use at which point it sends a REMB to 1124 // This test first observes "high" bitrate use at which point it sends a REMB to
1048 // indicate that it should be lowered significantly. The test then observes that 1125 // indicate that it should be lowered significantly. The test then observes that
1049 // the bitrate observed is sinking well below the min-transmit-bitrate threshold 1126 // the bitrate observed is sinking well below the min-transmit-bitrate threshold
1050 // to verify that the min-transmit bitrate respects incoming REMB. 1127 // to verify that the min-transmit bitrate respects incoming REMB.
1051 // 1128 //
1052 // Note that the test starts at "high" bitrate and does not ramp up to "higher" 1129 // Note that the test starts at "high" bitrate and does not ramp up to "higher"
1053 // bitrate since no receiver block or remb is sent in the initial phase. 1130 // bitrate since no receiver block or remb is sent in the initial phase.
1054 TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) { 1131 TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) {
1055 static const int kMinTransmitBitrateBps = 400000; 1132 static const int kMinTransmitBitrateBps = 400000;
1056 static const int kHighBitrateBps = 150000; 1133 static const int kHighBitrateBps = 150000;
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 observation_complete_.Set(); 2674 observation_complete_.Set();
2598 } 2675 }
2599 } 2676 }
2600 } test; 2677 } test;
2601 2678
2602 RunBaseTest(&test); 2679 RunBaseTest(&test);
2603 } 2680 }
2604 #endif // !defined(RTC_DISABLE_VP9) 2681 #endif // !defined(RTC_DISABLE_VP9)
2605 2682
2606 } // namespace webrtc 2683 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698