Simple CL to fix lint errors in webrtc/modules/remote_bitrate_estimator. Added the lint check for the folder to the presubmit script.

BUG=webrtc:5310

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

Cr-Commit-Position: refs/heads/master@{#11021}
This commit is contained in:
terelius 2015-12-15 00:51:54 -08:00 committed by Commit bot
parent 498ae00f39
commit 8f09f170e6
24 changed files with 116 additions and 108 deletions

View File

@ -20,6 +20,7 @@ CPPLINT_DIRS = [
'webrtc/call', 'webrtc/call',
'webrtc/common_video', 'webrtc/common_video',
'webrtc/examples', 'webrtc/examples',
'webrtc/modules/remote_bitrate_estimator',
'webrtc/modules/video_processing', 'webrtc/modules/video_processing',
'webrtc/sound', 'webrtc/sound',
'webrtc/tools', 'webrtc/tools',

View File

@ -88,8 +88,7 @@ uint32_t AimdRateControl::LatestEstimate() const {
uint32_t AimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) { uint32_t AimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) {
current_bitrate_bps_ = ChangeBitrate(current_bitrate_bps_, current_bitrate_bps_ = ChangeBitrate(current_bitrate_bps_,
current_input_._incomingBitRate, current_input_.incoming_bitrate, now_ms);
now_ms);
if (now_ms - time_of_last_log_ > kLogIntervalMs) { if (now_ms - time_of_last_log_ > kLogIntervalMs) {
time_of_last_log_ = now_ms; time_of_last_log_ = now_ms;
} }
@ -109,21 +108,21 @@ void AimdRateControl::Update(const RateControlInput* input, int64_t now_ms) {
const int64_t kInitializationTimeMs = 5000; const int64_t kInitializationTimeMs = 5000;
RTC_DCHECK_LE(kBitrateWindowMs, kInitializationTimeMs); RTC_DCHECK_LE(kBitrateWindowMs, kInitializationTimeMs);
if (time_first_incoming_estimate_ < 0) { if (time_first_incoming_estimate_ < 0) {
if (input->_incomingBitRate > 0) { if (input->incoming_bitrate > 0) {
time_first_incoming_estimate_ = now_ms; time_first_incoming_estimate_ = now_ms;
} }
} else if (now_ms - time_first_incoming_estimate_ > kInitializationTimeMs && } else if (now_ms - time_first_incoming_estimate_ > kInitializationTimeMs &&
input->_incomingBitRate > 0) { input->incoming_bitrate > 0) {
current_bitrate_bps_ = input->_incomingBitRate; current_bitrate_bps_ = input->incoming_bitrate;
bitrate_is_initialized_ = true; bitrate_is_initialized_ = true;
} }
} }
if (updated_ && current_input_._bwState == kBwOverusing) { if (updated_ && current_input_.bw_state == kBwOverusing) {
// Only update delay factor and incoming bit rate. We always want to react // Only update delay factor and incoming bit rate. We always want to react
// on an over-use. // on an over-use.
current_input_._noiseVar = input->_noiseVar; current_input_.noise_var = input->noise_var;
current_input_._incomingBitRate = input->_incomingBitRate; current_input_.incoming_bitrate = input->incoming_bitrate;
} else { } else {
updated_ = true; updated_ = true;
current_input_ = *input; current_input_ = *input;
@ -145,7 +144,7 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t current_bitrate_bps,
// An over-use should always trigger us to reduce the bitrate, even though // An over-use should always trigger us to reduce the bitrate, even though
// we have not yet established our first estimate. By acting on the over-use, // we have not yet established our first estimate. By acting on the over-use,
// we will end up with a valid estimate. // we will end up with a valid estimate.
if (!bitrate_is_initialized_ && current_input_._bwState != kBwOverusing) if (!bitrate_is_initialized_ && current_input_.bw_state != kBwOverusing)
return current_bitrate_bps_; return current_bitrate_bps_;
updated_ = false; updated_ = false;
ChangeState(current_input_, now_ms); ChangeState(current_input_, now_ms);
@ -284,7 +283,7 @@ void AimdRateControl::UpdateMaxBitRateEstimate(float incoming_bitrate_kbps) {
void AimdRateControl::ChangeState(const RateControlInput& input, void AimdRateControl::ChangeState(const RateControlInput& input,
int64_t now_ms) { int64_t now_ms) {
switch (current_input_._bwState) { switch (current_input_.bw_state) {
case kBwNormal: case kBwNormal:
if (rate_control_state_ == kRcHold) { if (rate_control_state_ == kRcHold) {
time_last_bitrate_change_ = now_ms; time_last_bitrate_change_ = now_ms;

View File

@ -74,7 +74,6 @@ TEST_P(BweSimulation, Verizon4gDownlinkTest) {
} }
TEST_P(BweSimulation, Choke1000kbps500kbps1000kbpsBiDirectional) { TEST_P(BweSimulation, Choke1000kbps500kbps1000kbpsBiDirectional) {
const int kFlowIds[] = {0, 1}; const int kFlowIds[] = {0, 1};
const size_t kNumFlows = sizeof(kFlowIds) / sizeof(kFlowIds[0]); const size_t kNumFlows = sizeof(kFlowIds) / sizeof(kFlowIds[0]);
@ -106,7 +105,6 @@ TEST_P(BweSimulation, Choke1000kbps500kbps1000kbpsBiDirectional) {
} }
TEST_P(BweSimulation, Choke1000kbps500kbps1000kbps) { TEST_P(BweSimulation, Choke1000kbps500kbps1000kbps) {
AdaptiveVideoSource source(0, 30, 300, 0, 0); AdaptiveVideoSource source(0, 30, 300, 0, 0);
VideoSender sender(&uplink_, &source, GetParam()); VideoSender sender(&uplink_, &source, GetParam());
ChokeFilter choke(&uplink_, 0); ChokeFilter choke(&uplink_, 0);
@ -243,7 +241,7 @@ TEST_P(BweSimulation, PacerGoogleWifiTrace3Mbps) {
} }
TEST_P(BweSimulation, SelfFairnessTest) { TEST_P(BweSimulation, SelfFairnessTest) {
srand(Clock::GetRealTimeClock()->TimeInMicroseconds()); Random prng(Clock::GetRealTimeClock()->TimeInMicroseconds());
const int kAllFlowIds[] = {0, 1, 2, 3}; const int kAllFlowIds[] = {0, 1, 2, 3};
const size_t kNumFlows = sizeof(kAllFlowIds) / sizeof(kAllFlowIds[0]); const size_t kNumFlows = sizeof(kAllFlowIds) / sizeof(kAllFlowIds[0]);
rtc::scoped_ptr<VideoSource> sources[kNumFlows]; rtc::scoped_ptr<VideoSource> sources[kNumFlows];
@ -252,7 +250,7 @@ TEST_P(BweSimulation, SelfFairnessTest) {
// Streams started 20 seconds apart to give them different advantage when // Streams started 20 seconds apart to give them different advantage when
// competing for the bandwidth. // competing for the bandwidth.
sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0, sources[i].reset(new AdaptiveVideoSource(kAllFlowIds[i], 30, 300, 0,
i * (rand() % 40000))); i * prng.Rand(39999)));
senders[i].reset(new VideoSender(&uplink_, sources[i].get(), GetParam())); senders[i].reset(new VideoSender(&uplink_, sources[i].get(), GetParam()));
} }

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_BWE_DEFINES_H_ #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_BWE_DEFINES_H_ #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
@ -20,41 +20,28 @@ namespace webrtc {
static const int64_t kBitrateWindowMs = 1000; static const int64_t kBitrateWindowMs = 1000;
enum BandwidthUsage enum BandwidthUsage {
{
kBwNormal = 0, kBwNormal = 0,
kBwUnderusing = 1, kBwUnderusing = 1,
kBwOverusing = 2, kBwOverusing = 2,
}; };
enum RateControlState enum RateControlState { kRcHold, kRcIncrease, kRcDecrease };
{
kRcHold,
kRcIncrease,
kRcDecrease
};
enum RateControlRegion enum RateControlRegion { kRcNearMax, kRcAboveMax, kRcMaxUnknown };
{
kRcNearMax,
kRcAboveMax,
kRcMaxUnknown
};
class RateControlInput struct RateControlInput {
{ RateControlInput(BandwidthUsage bw_state,
public: uint32_t incoming_bitrate,
RateControlInput(BandwidthUsage bwState, double noise_var)
uint32_t incomingBitRate, : bw_state(bw_state),
double noiseVar) incoming_bitrate(incoming_bitrate),
: _bwState(bwState), noise_var(noise_var) {}
_incomingBitRate(incomingBitRate),
_noiseVar(noiseVar) {}
BandwidthUsage _bwState; BandwidthUsage bw_state;
uint32_t _incomingBitRate; uint32_t incoming_bitrate;
double _noiseVar; double noise_var;
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_BWE_DEFINES_H_ #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_ESTIMATOR_H_ #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_OBSERVER_H_
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_ESTIMATOR_H_ #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_OBSERVER_H_
#include <vector> #include <vector>
@ -26,4 +26,4 @@ class MockRemoteBitrateObserver : public RemoteBitrateObserver {
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_ESTIMATOR_H_ #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_MOCK_MOCK_REMOTE_BITRATE_OBSERVER_H_

View File

@ -8,8 +8,8 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_ #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_SEND_TIME_HISTORY_H_
#define WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_ #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_SEND_TIME_HISTORY_H_
#include <map> #include <map>
@ -45,4 +45,4 @@ class SendTimeHistory {
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_ #endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_SEND_TIME_HISTORY_H_

View File

@ -71,8 +71,7 @@ bool InterArrival::ComputeDeltas(uint32_t timestamp,
current_timestamp_group_.first_timestamp = timestamp; current_timestamp_group_.first_timestamp = timestamp;
current_timestamp_group_.timestamp = timestamp; current_timestamp_group_.timestamp = timestamp;
current_timestamp_group_.size = 0; current_timestamp_group_.size = 0;
} } else {
else {
current_timestamp_group_.timestamp = LatestTimestamp( current_timestamp_group_.timestamp = LatestTimestamp(
current_timestamp_group_.timestamp, timestamp); current_timestamp_group_.timestamp, timestamp);
} }

View File

@ -10,11 +10,13 @@
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h" #include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h"
#include <algorithm>
#include <sstream>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <algorithm>
#include <sstream>
#include <string>
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/common.h" #include "webrtc/base/common.h"
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"

View File

@ -9,6 +9,8 @@
*/ */
#include <math.h> #include <math.h>
#include <algorithm>
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>

View File

@ -10,12 +10,13 @@
#include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h" #include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h"
#include <algorithm>
#include <assert.h> #include <assert.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <algorithm>
#include "webrtc/base/logging.h" #include "webrtc/base/logging.h"
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"

View File

@ -12,6 +12,8 @@
#include <math.h> #include <math.h>
#include <algorithm>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/logging.h" #include "webrtc/base/logging.h"
#include "webrtc/base/scoped_ptr.h" #include "webrtc/base/scoped_ptr.h"

View File

@ -17,7 +17,6 @@ namespace webrtc {
class RemoteBitrateEstimatorAbsSendTimeTest : class RemoteBitrateEstimatorAbsSendTimeTest :
public RemoteBitrateEstimatorTest { public RemoteBitrateEstimatorTest {
public: public:
RemoteBitrateEstimatorAbsSendTimeTest() {} RemoteBitrateEstimatorAbsSendTimeTest() {}
virtual void SetUp() { virtual void SetUp() {
bitrate_estimator_.reset(new RemoteBitrateEstimatorAbsSendTime( bitrate_estimator_.reset(new RemoteBitrateEstimatorAbsSendTime(

View File

@ -10,6 +10,8 @@
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h" #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h"
#include <utility>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/logging.h" #include "webrtc/base/logging.h"
#include "webrtc/base/scoped_ptr.h" #include "webrtc/base/scoped_ptr.h"
@ -32,7 +34,8 @@ struct RemoteBitrateEstimatorSingleStream::Detector {
const OverUseDetectorOptions& options, const OverUseDetectorOptions& options,
bool enable_burst_grouping) bool enable_burst_grouping)
: last_packet_time_ms(last_packet_time_ms), : last_packet_time_ms(last_packet_time_ms),
inter_arrival(90 * kTimestampGroupLengthMs, kTimestampToMs, inter_arrival(90 * kTimestampGroupLengthMs,
kTimestampToMs,
enable_burst_grouping), enable_burst_grouping),
estimator(options), estimator(options),
detector(options) {} detector(options) {}

View File

@ -17,7 +17,6 @@ namespace webrtc {
class RemoteBitrateEstimatorSingleTest : class RemoteBitrateEstimatorSingleTest :
public RemoteBitrateEstimatorTest { public RemoteBitrateEstimatorTest {
public: public:
RemoteBitrateEstimatorSingleTest() {} RemoteBitrateEstimatorSingleTest() {}
virtual void SetUp() { virtual void SetUp() {
bitrate_estimator_.reset(new RemoteBitrateEstimatorSingleStream( bitrate_estimator_.reset(new RemoteBitrateEstimatorSingleStream(

View File

@ -10,6 +10,7 @@
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.h" #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.h"
#include <algorithm> #include <algorithm>
#include <limits>
#include <utility> #include <utility>
namespace webrtc { namespace webrtc {
@ -383,10 +384,10 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper(
2 * kFrameIntervalAbsSendTime); 2 * kFrameIntervalAbsSendTime);
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp, IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
absolute_send_time, true); absolute_send_time, true);
IncomingPacket( IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(),
kDefaultSsrc, 1000, clock_.TimeInMilliseconds(),
timestamp - 90 * kFrameIntervalMs, timestamp - 90 * kFrameIntervalMs,
AddAbsSendTime(absolute_send_time, -int(kFrameIntervalAbsSendTime)), AddAbsSendTime(absolute_send_time,
-static_cast<int>(kFrameIntervalAbsSendTime)),
true); true);
} }
bitrate_estimator_->Process(); bitrate_estimator_->Process();
@ -520,8 +521,8 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() {
uint32_t timestamp = 0; uint32_t timestamp = 0;
// Initialize absolute_send_time (24 bits) so that it will definitely wrap // Initialize absolute_send_time (24 bits) so that it will definitely wrap
// during the test. // during the test.
uint32_t absolute_send_time = uint32_t absolute_send_time = AddAbsSendTime(
AddAbsSendTime((1 << 24), -int(50 * kFrameIntervalAbsSendTime)); (1 << 24), -static_cast<int>(50 * kFrameIntervalAbsSendTime));
// Initial set of frames to increase the bitrate. 6 seconds to have enough // Initial set of frames to increase the bitrate. 6 seconds to have enough
// time for the first estimate to be generated and for Process() to be called. // time for the first estimate to be generated and for Process() to be called.
for (int i = 0; i <= 6 * kFramerate; ++i) { for (int i = 0; i <= 6 * kFramerate; ++i) {
@ -556,8 +557,10 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() {
// Increase time until next batch to simulate over-use. // Increase time until next batch to simulate over-use.
clock_.AdvanceTimeMilliseconds(10); clock_.AdvanceTimeMilliseconds(10);
timestamp += 90 * kFrameIntervalMs - kTimestampGroupLength; timestamp += 90 * kFrameIntervalMs - kTimestampGroupLength;
absolute_send_time = AddAbsSendTime(absolute_send_time, AddAbsSendTime( absolute_send_time = AddAbsSendTime(
kFrameIntervalAbsSendTime, -int(kTimestampGroupLengthAbsSendTime))); absolute_send_time,
AddAbsSendTime(kFrameIntervalAbsSendTime,
-static_cast<int>(kTimestampGroupLengthAbsSendTime)));
bitrate_estimator_->Process(); bitrate_estimator_->Process();
} }
EXPECT_TRUE(bitrate_observer_->updated()); EXPECT_TRUE(bitrate_observer_->updated());

View File

@ -14,6 +14,7 @@
#include <list> #include <list>
#include <map> #include <map>
#include <utility> #include <utility>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"

View File

@ -13,8 +13,10 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <algorithm>
#include <sstream> #include <sstream>
#include "webrtc/base/random.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h" #include "webrtc/modules/remote_bitrate_estimator/test/bwe_test.h"
#include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h" #include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h"
@ -242,18 +244,20 @@ class BweFeedbackTest
: public BweTest, : public BweTest,
public ::testing::TestWithParam<BandwidthEstimatorType> { public ::testing::TestWithParam<BandwidthEstimatorType> {
public: public:
BweFeedbackTest() : BweTest() {} #ifdef WEBRTC_WIN
BweFeedbackTest()
: BweTest(), random_(Clock::GetRealTimeClock()->TimeInMicroseconds()) {}
#else
BweFeedbackTest()
: BweTest(),
// Multiply the time by a random-ish odd number derived from the PID.
random_((getpid() | 1) *
Clock::GetRealTimeClock()->TimeInMicroseconds()) {}
#endif
virtual ~BweFeedbackTest() {} virtual ~BweFeedbackTest() {}
protected: protected:
void SetUp() override { Random random_;
unsigned int seed = Clock::GetRealTimeClock()->TimeInMicroseconds();
#ifndef WEBRTC_WIN
seed *= getpid();
#endif
srand(seed);
BweTest::SetUp();
}
private: private:
RTC_DISALLOW_COPY_AND_ASSIGN(BweFeedbackTest); RTC_DISALLOW_COPY_AND_ASSIGN(BweFeedbackTest);
@ -356,7 +360,7 @@ TEST_P(BweFeedbackTest, PacedSelfFairness50msTest) {
const int kNumRmcatFlows = 4; const int kNumRmcatFlows = 4;
int64_t offset_ms[kNumRmcatFlows]; int64_t offset_ms[kNumRmcatFlows];
for (int i = 0; i < kNumRmcatFlows; ++i) { for (int i = 0; i < kNumRmcatFlows; ++i) {
offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000));
} }
RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 50, kRttMs, RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 50, kRttMs,
@ -370,7 +374,7 @@ TEST_P(BweFeedbackTest, PacedSelfFairness500msTest) {
const int kNumRmcatFlows = 4; const int kNumRmcatFlows = 4;
int64_t offset_ms[kNumRmcatFlows]; int64_t offset_ms[kNumRmcatFlows];
for (int i = 0; i < kNumRmcatFlows; ++i) { for (int i = 0; i < kNumRmcatFlows; ++i) {
offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000));
} }
RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 500, kRttMs, RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 500, kRttMs,
@ -384,7 +388,7 @@ TEST_P(BweFeedbackTest, PacedSelfFairness1000msTest) {
const int kNumRmcatFlows = 4; const int kNumRmcatFlows = 4;
int64_t offset_ms[kNumRmcatFlows]; int64_t offset_ms[kNumRmcatFlows];
for (int i = 0; i < kNumRmcatFlows; ++i) { for (int i = 0; i < kNumRmcatFlows; ++i) {
offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000));
} }
RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 1000, kRttMs, RunFairnessTest(GetParam(), kNumRmcatFlows, 0, 300, 3000, 1000, kRttMs,
@ -397,7 +401,7 @@ TEST_P(BweFeedbackTest, TcpFairness50msTest) {
int64_t offset_ms[2]; // One TCP, one RMCAT flow. int64_t offset_ms[2]; // One TCP, one RMCAT flow.
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000));
} }
RunFairnessTest(GetParam(), 1, 1, 300, 2000, 50, kRttMs, kMaxJitterMs, RunFairnessTest(GetParam(), 1, 1, 300, 2000, 50, kRttMs, kMaxJitterMs,
@ -410,7 +414,7 @@ TEST_P(BweFeedbackTest, TcpFairness500msTest) {
int64_t offset_ms[2]; // One TCP, one RMCAT flow. int64_t offset_ms[2]; // One TCP, one RMCAT flow.
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000));
} }
RunFairnessTest(GetParam(), 1, 1, 300, 2000, 500, kRttMs, kMaxJitterMs, RunFairnessTest(GetParam(), 1, 1, 300, 2000, 500, kRttMs, kMaxJitterMs,
@ -423,7 +427,7 @@ TEST_P(BweFeedbackTest, TcpFairness1000msTest) {
int64_t offset_ms[2]; // One TCP, one RMCAT flow. int64_t offset_ms[2]; // One TCP, one RMCAT flow.
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
offset_ms[i] = std::max(0, 5000 * i + rand() % 2001 - 1000); offset_ms[i] = std::max(0, 5000 * i + random_.Rand(-1000, 1000));
} }
RunFairnessTest(GetParam(), 1, 1, 300, 2000, 1000, kRttMs, kMaxJitterMs, RunFairnessTest(GetParam(), 1, 1, 300, 2000, 1000, kRttMs, kMaxJitterMs,

View File

@ -11,7 +11,10 @@
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_ #ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_ #define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_
#include <list>
#include <map>
#include <sstream> #include <sstream>
#include <string>
#include "webrtc/test/testsupport/gtest_prod_util.h" #include "webrtc/test/testsupport/gtest_prod_util.h"
#include "webrtc/modules/remote_bitrate_estimator/test/packet.h" #include "webrtc/modules/remote_bitrate_estimator/test/packet.h"

View File

@ -680,6 +680,7 @@ VideoSource::VideoSource(int flow_id,
frame_period_ms_(1000.0 / fps), frame_period_ms_(1000.0 / fps),
bits_per_second_(1000 * kbps), bits_per_second_(1000 * kbps),
frame_size_bytes_(bits_per_second_ / 8 / fps), frame_size_bytes_(bits_per_second_ / 8 / fps),
random_(0x12345678),
flow_id_(flow_id), flow_id_(flow_id),
next_frame_ms_(first_frame_offset_ms), next_frame_ms_(first_frame_offset_ms),
next_frame_rand_ms_(0), next_frame_rand_ms_(0),
@ -713,9 +714,7 @@ void VideoSource::RunFor(int64_t time_ms, Packets* in_out) {
const int64_t kRandAmplitude = 2; const int64_t kRandAmplitude = 2;
// A variance picked uniformly from {-1, 0, 1} ms is added to the frame // A variance picked uniformly from {-1, 0, 1} ms is added to the frame
// timestamp. // timestamp.
next_frame_rand_ms_ = next_frame_rand_ms_ = kRandAmplitude * (random_.Rand<float>() - 0.5);
kRandAmplitude * static_cast<float>(rand()) / RAND_MAX -
kRandAmplitude / 2;
// Ensure frame will not have a negative timestamp. // Ensure frame will not have a negative timestamp.
int64_t next_frame_ms = int64_t next_frame_ms =

View File

@ -17,8 +17,10 @@
#include <algorithm> #include <algorithm>
#include <list> #include <list>
#include <numeric> #include <numeric>
#include <set>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
#include "webrtc/base/common.h" #include "webrtc/base/common.h"
@ -44,7 +46,7 @@ class DelayCapHelper;
class RateCounter { class RateCounter {
public: public:
RateCounter(int64_t window_size_ms) explicit RateCounter(int64_t window_size_ms)
: window_size_us_(1000 * window_size_ms), : window_size_us_(1000 * window_size_ms),
recently_received_packets_(0), recently_received_packets_(0),
recently_received_bytes_(0), recently_received_bytes_(0),
@ -415,6 +417,7 @@ class VideoSource {
uint32_t frame_size_bytes_; uint32_t frame_size_bytes_;
private: private:
Random random_;
const int flow_id_; const int flow_id_;
int64_t next_frame_ms_; int64_t next_frame_ms_;
int64_t next_frame_rand_ms_; int64_t next_frame_rand_ms_;

View File

@ -10,10 +10,10 @@
#include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h" #include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h"
#include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
#include <algorithm> #include <algorithm>
#include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
namespace webrtc { namespace webrtc {
namespace testing { namespace testing {
namespace bwe { namespace bwe {

View File

@ -13,6 +13,7 @@
#include <list> #include <list>
#include <limits> #include <limits>
#include <set>
#include <string> #include <string>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
@ -149,7 +150,7 @@ class TcpSender : public PacketSender {
private: private:
struct InFlight { struct InFlight {
public: public:
InFlight(const MediaPacket& packet) explicit InFlight(const MediaPacket& packet)
: sequence_number(packet.header().sequenceNumber), : sequence_number(packet.header().sequenceNumber),
time_ms(packet.send_time_ms()) {} time_ms(packet.send_time_ms()) {}

View File

@ -10,8 +10,10 @@
#include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h" #include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h"
#include <sstream>
#include <stdio.h> #include <stdio.h>
#include <set>
#include <sstream>
#include <string> #include <string>
#include "gflags/gflags.h" #include "gflags/gflags.h"