Testing that media is resumed when congestion ends.
Expanded congestion window test to test that media is resumed after
being stopped due to congestion window getting filled. Previously only
the behavior that padding packets was sent in congested state was tested,
but not that media actually was resumed when feedback from the padding
packets was received.
Bug: None
Change-Id: Icd494c2e5386926f92c4d5dd0e8bc80c81608325
Reviewed-on: https://webrtc-review.googlesource.com/46262
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21941}
diff --git a/video/end_to_end_tests/transport_feedback_tests.cc b/video/end_to_end_tests/transport_feedback_tests.cc
index e43c939..79e6244 100644
--- a/video/end_to_end_tests/transport_feedback_tests.cc
+++ b/video/end_to_end_tests/transport_feedback_tests.cc
@@ -339,7 +339,8 @@
RunBaseTest(&test);
}
-TEST_P(TransportFeedbackEndToEndTest, StopsSendingMediaWithoutFeedback) {
+TEST_P(TransportFeedbackEndToEndTest,
+ StopsAndResumesMediaWhenCongestionWindowFull) {
test::ScopedFieldTrials override_field_trials(
"WebRTC-CwndExperiment/Enabled-250/");
@@ -351,6 +352,7 @@
num_video_streams_(num_video_streams),
num_audio_streams_(num_audio_streams),
media_sent_(0),
+ media_sent_before_(0),
padding_sent_(0) {
// Only one stream of each supported for now.
EXPECT_LE(num_video_streams, 1u);
@@ -364,19 +366,35 @@
const bool only_padding =
header.headerLength + header.paddingLength == length;
rtc::CritScope lock(&crit_);
+ // Padding is expected in congested state to probe for connectivity when
+ // packets has been dropped.
if (only_padding) {
+ media_sent_before_ = media_sent_;
++padding_sent_;
} else {
++media_sent_;
- EXPECT_LT(media_sent_, 40) << "Media sent without feedback.";
+ if (padding_sent_ == 0) {
+ ++media_sent_before_;
+ EXPECT_LT(media_sent_, 40)
+ << "Media sent without feedback when congestion window is full.";
+ }
}
-
return SEND_PACKET;
}
Action OnReceiveRtcp(const uint8_t* data, size_t length) override {
rtc::CritScope lock(&crit_);
- if (media_sent_ > 20 && HasTransportFeedback(data, length)) {
+ // To fill up the congestion window we drop feedback on packets after 20
+ // packets have been sent. This means that any packets that has not yet
+ // received feedback after that will be considered as oustanding data and
+ // therefore filling up the congestion window. In the congested state, the
+ // pacer should send padding packets to trigger feedback in case all
+ // feedback of previous traffic was lost. This test listens for the
+ // padding packets and when 3 padding packets has been received feedback
+ // will be let trough again. This should cause the pacer to continue
+ // sending meadia yet again.
+ if (media_sent_ > 20 && HasTransportFeedback(data, length) &&
+ padding_sent_ < 3) {
return DROP_PACKET;
}
return SEND_PACKET;
@@ -395,10 +413,13 @@
}
void PerformTest() override {
- const int64_t kDisabledFeedbackTimeoutMs = 10000;
+ const int64_t kDisabledFeedbackTimeoutMs = 3000;
observation_complete_.Wait(kDisabledFeedbackTimeoutMs);
- rtc::CritScope lock(&crit_);
- EXPECT_GT(padding_sent_, 0);
+ {
+ rtc::CritScope lock(&crit_);
+ EXPECT_GT(media_sent_, media_sent_before_)
+ << "Stream not continued after congestion window full.";
+ }
}
size_t GetNumVideoStreams() const override { return num_video_streams_; }
@@ -409,6 +430,7 @@
const size_t num_audio_streams_;
rtc::CriticalSection crit_;
int media_sent_ RTC_GUARDED_BY(crit_);
+ int media_sent_before_ RTC_GUARDED_BY(crit_);
int padding_sent_ RTC_GUARDED_BY(crit_);
} test(1, 0);
RunBaseTest(&test);