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

Unified Diff: webrtc/video/end_to_end_tests.cc

Issue 2420443002: Fix for flaky test: EndToEndTest.VerifyHistogramStatsWithRtx (Closed)
Patch Set: start counting frames when ntp time is valid 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/end_to_end_tests.cc
diff --git a/webrtc/video/end_to_end_tests.cc b/webrtc/video/end_to_end_tests.cc
index 631f4d9cb7aa0518f2f21f03de84f659c6074428..9b762edfb314aaf7dbcc6dce2569369a7b58deb9 100644
--- a/webrtc/video/end_to_end_tests.cc
+++ b/webrtc/video/end_to_end_tests.cc
@@ -2125,13 +2125,24 @@ void EndToEndTest::VerifyHistogramStats(bool use_rtx,
: nullptr),
sender_call_(nullptr),
receiver_call_(nullptr),
- start_runtime_ms_(-1) {}
+ start_runtime_ms_(-1),
+ num_frames_received_(0) {}
private:
- void OnFrame(const VideoFrame& video_frame) override {}
+ void OnFrame(const VideoFrame& video_frame) override {
+ // The RTT is needed to estimate |ntp_time_ms| which is used by
+ // end-to-end delay stats. Therefore, start counting received frames once
+ // |ntp_time_ms| is valid.
+ if (video_frame.ntp_time_ms() > 0 &&
+ Clock::GetRealTimeClock()->CurrentNtpInMilliseconds() >=
+ video_frame.ntp_time_ms()) {
+ rtc::CritScope lock(&crit_);
+ ++num_frames_received_;
+ }
+ }
Action OnSendRtp(const uint8_t* packet, size_t length) override {
- if (MinMetricRunTimePassed())
+ if (MinMetricRunTimePassed() && MinNumberOfFramesReceived())
observation_complete_.Set();
return SEND_PACKET;
@@ -2147,6 +2158,12 @@ void EndToEndTest::VerifyHistogramStats(bool use_rtx,
return elapsed_sec > metrics::kMinRunTimeInSeconds * 2;
}
+ bool MinNumberOfFramesReceived() const {
+ const int kMinRequiredHistogramSamples = 200;
+ rtc::CritScope lock(&crit_);
+ return num_frames_received_ > kMinRequiredHistogramSamples;
+ }
+
void ModifyVideoConfigs(
VideoSendStream::Config* send_config,
std::vector<VideoReceiveStream::Config>* receive_configs,
@@ -2196,6 +2213,7 @@ void EndToEndTest::VerifyHistogramStats(bool use_rtx,
EXPECT_TRUE(Wait()) << "Timed out waiting for packet to be NACKed.";
}
+ rtc::CriticalSection crit_;
const bool use_rtx_;
const bool use_red_;
const bool screenshare_;
@@ -2203,6 +2221,7 @@ void EndToEndTest::VerifyHistogramStats(bool use_rtx,
Call* sender_call_;
Call* receiver_call_;
int64_t start_runtime_ms_;
+ int num_frames_received_ GUARDED_BY(&crit_);
} test(use_rtx, use_red, screenshare);
metrics::Reset();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698