Fix race in VideoSendStreamTest.RtcpSenderReportContainsMediaBytesSent.

BUG=webrtc:5194

Review URL: https://codereview.webrtc.org/1434963002

Cr-Commit-Position: refs/heads/master@{#10602}
This commit is contained in:
stefan
2015-11-11 06:39:57 -08:00
committed by Commit bot
parent 00ac85e2e3
commit 4b56904b70

View File

@ -1522,6 +1522,7 @@ TEST_F(VideoSendStreamTest, RtcpSenderReportContainsMediaBytesSent) {
private:
Action OnSendRtp(const uint8_t* packet, size_t length) override {
rtc::CritScope lock(&crit_);
RTPHeader header;
EXPECT_TRUE(parser_->Parse(packet, length, &header));
++rtp_packets_sent_;
@ -1530,6 +1531,7 @@ TEST_F(VideoSendStreamTest, RtcpSenderReportContainsMediaBytesSent) {
}
Action OnSendRtcp(const uint8_t* packet, size_t length) override {
rtc::CritScope lock(&crit_);
RTCPUtility::RTCPParserV2 parser(packet, length, true);
EXPECT_TRUE(parser.IsValid());
@ -1556,8 +1558,9 @@ TEST_F(VideoSendStreamTest, RtcpSenderReportContainsMediaBytesSent) {
<< "Timed out while waiting for RTCP sender report.";
}
size_t rtp_packets_sent_;
size_t media_bytes_sent_;
rtc::CriticalSection crit_;
size_t rtp_packets_sent_ GUARDED_BY(&crit_);
size_t media_bytes_sent_ GUARDED_BY(&crit_);
} test;
RunBaseTest(&test, FakeNetworkPipe::Config());