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

Unified Diff: webrtc/video/video_send_stream_tests.cc

Issue 2708573003: Fix race condition in VideoSendStreamTest.ChangingTransportOverhead (Closed)
Patch Set: Created 3 years, 10 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/video_send_stream_tests.cc
diff --git a/webrtc/video/video_send_stream_tests.cc b/webrtc/video/video_send_stream_tests.cc
index 196918a4eb4695d162e95e645ffa579cc51c728a..189f0304dcee60e19dbdae1f3cce323daa7ac8e1 100644
--- a/webrtc/video/video_send_stream_tests.cc
+++ b/webrtc/video/video_send_stream_tests.cc
@@ -1473,6 +1473,7 @@ TEST_F(VideoSendStreamTest, ChangingTransportOverhead) {
Action OnSendRtp(const uint8_t* packet, size_t length) override {
EXPECT_LE(length, kMaxRtpPacketSize);
+ rtc::CritScope cs(&lock_);
if (++packets_sent_ < 100)
return SEND_PACKET;
observation_complete_.Set();
@@ -1491,7 +1492,10 @@ TEST_F(VideoSendStreamTest, ChangingTransportOverhead) {
call_->OnTransportOverheadChanged(webrtc::MediaType::VIDEO,
transport_overhead_);
EXPECT_TRUE(Wait());
- packets_sent_ = 0;
+ {
+ rtc::CritScope cs(&lock_);
+ packets_sent_ = 0;
+ }
transport_overhead_ = 500;
call_->OnTransportOverheadChanged(webrtc::MediaType::VIDEO,
transport_overhead_);
@@ -1500,7 +1504,8 @@ TEST_F(VideoSendStreamTest, ChangingTransportOverhead) {
private:
Call* call_;
- int packets_sent_;
+ rtc::CriticalSection lock_;
+ int packets_sent_ GUARDED_BY(lock_);
int transport_overhead_;
const size_t kMaxRtpPacketSize = 1000;
} test;
« 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