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:
parent
498ae00f39
commit
8f09f170e6
@ -20,6 +20,7 @@ CPPLINT_DIRS = [
|
||||
'webrtc/call',
|
||||
'webrtc/common_video',
|
||||
'webrtc/examples',
|
||||
'webrtc/modules/remote_bitrate_estimator',
|
||||
'webrtc/modules/video_processing',
|
||||
'webrtc/sound',
|
||||
'webrtc/tools',
|
||||
|
||||
@ -88,8 +88,7 @@ uint32_t AimdRateControl::LatestEstimate() const {
|
||||
|
||||
uint32_t AimdRateControl::UpdateBandwidthEstimate(int64_t now_ms) {
|
||||
current_bitrate_bps_ = ChangeBitrate(current_bitrate_bps_,
|
||||
current_input_._incomingBitRate,
|
||||
now_ms);
|
||||
current_input_.incoming_bitrate, now_ms);
|
||||
if (now_ms - time_of_last_log_ > kLogIntervalMs) {
|
||||
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;
|
||||
RTC_DCHECK_LE(kBitrateWindowMs, kInitializationTimeMs);
|
||||
if (time_first_incoming_estimate_ < 0) {
|
||||
if (input->_incomingBitRate > 0) {
|
||||
if (input->incoming_bitrate > 0) {
|
||||
time_first_incoming_estimate_ = now_ms;
|
||||
}
|
||||
} else if (now_ms - time_first_incoming_estimate_ > kInitializationTimeMs &&
|
||||
input->_incomingBitRate > 0) {
|
||||
current_bitrate_bps_ = input->_incomingBitRate;
|
||||
input->incoming_bitrate > 0) {
|
||||
current_bitrate_bps_ = input->incoming_bitrate;
|
||||
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
|
||||
// on an over-use.
|
||||
current_input_._noiseVar = input->_noiseVar;
|
||||
current_input_._incomingBitRate = input->_incomingBitRate;
|
||||
current_input_.noise_var = input->noise_var;
|
||||
current_input_.incoming_bitrate = input->incoming_bitrate;
|
||||
} else {
|
||||
updated_ = true;
|
||||
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
|
||||
// we have not yet established our first estimate. By acting on the over-use,
|
||||
// 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_;
|
||||
updated_ = false;
|
||||
ChangeState(current_input_, now_ms);
|
||||
@ -284,7 +283,7 @@ void AimdRateControl::UpdateMaxBitRateEstimate(float incoming_bitrate_kbps) {
|
||||
|
||||
void AimdRateControl::ChangeState(const RateControlInput& input,
|
||||
int64_t now_ms) {
|
||||
switch (current_input_._bwState) {
|
||||
switch (current_input_.bw_state) {
|
||||
case kBwNormal:
|
||||
if (rate_control_state_ == kRcHold) {
|
||||
time_last_bitrate_change_ = now_ms;
|
||||
|
||||
@ -84,4 +84,4 @@ class AimdRateControl {
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_AIMD_RATE_CONTROL_H_
|
||||
|
||||
@ -74,7 +74,6 @@ TEST_P(BweSimulation, Verizon4gDownlinkTest) {
|
||||
}
|
||||
|
||||
TEST_P(BweSimulation, Choke1000kbps500kbps1000kbpsBiDirectional) {
|
||||
|
||||
const int kFlowIds[] = {0, 1};
|
||||
const size_t kNumFlows = sizeof(kFlowIds) / sizeof(kFlowIds[0]);
|
||||
|
||||
@ -106,7 +105,6 @@ TEST_P(BweSimulation, Choke1000kbps500kbps1000kbpsBiDirectional) {
|
||||
}
|
||||
|
||||
TEST_P(BweSimulation, Choke1000kbps500kbps1000kbps) {
|
||||
|
||||
AdaptiveVideoSource source(0, 30, 300, 0, 0);
|
||||
VideoSender sender(&uplink_, &source, GetParam());
|
||||
ChokeFilter choke(&uplink_, 0);
|
||||
@ -243,7 +241,7 @@ TEST_P(BweSimulation, PacerGoogleWifiTrace3Mbps) {
|
||||
}
|
||||
|
||||
TEST_P(BweSimulation, SelfFairnessTest) {
|
||||
srand(Clock::GetRealTimeClock()->TimeInMicroseconds());
|
||||
Random prng(Clock::GetRealTimeClock()->TimeInMicroseconds());
|
||||
const int kAllFlowIds[] = {0, 1, 2, 3};
|
||||
const size_t kNumFlows = sizeof(kAllFlowIds) / sizeof(kAllFlowIds[0]);
|
||||
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
|
||||
// competing for the bandwidth.
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
@ -8,53 +8,40 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_BWE_DEFINES_H_
|
||||
#define WEBRTC_MODULES_RTP_RTCP_SOURCE_BWE_DEFINES_H_
|
||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
|
||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
|
||||
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
#define BWE_MAX(a,b) ((a)>(b)?(a):(b))
|
||||
#define BWE_MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#define BWE_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define BWE_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
static const int64_t kBitrateWindowMs = 1000;
|
||||
|
||||
enum BandwidthUsage
|
||||
{
|
||||
kBwNormal = 0,
|
||||
kBwUnderusing = 1,
|
||||
kBwOverusing = 2,
|
||||
enum BandwidthUsage {
|
||||
kBwNormal = 0,
|
||||
kBwUnderusing = 1,
|
||||
kBwOverusing = 2,
|
||||
};
|
||||
|
||||
enum RateControlState
|
||||
{
|
||||
kRcHold,
|
||||
kRcIncrease,
|
||||
kRcDecrease
|
||||
};
|
||||
enum RateControlState { kRcHold, kRcIncrease, kRcDecrease };
|
||||
|
||||
enum RateControlRegion
|
||||
{
|
||||
kRcNearMax,
|
||||
kRcAboveMax,
|
||||
kRcMaxUnknown
|
||||
};
|
||||
enum RateControlRegion { kRcNearMax, kRcAboveMax, kRcMaxUnknown };
|
||||
|
||||
class RateControlInput
|
||||
{
|
||||
public:
|
||||
RateControlInput(BandwidthUsage bwState,
|
||||
uint32_t incomingBitRate,
|
||||
double noiseVar)
|
||||
: _bwState(bwState),
|
||||
_incomingBitRate(incomingBitRate),
|
||||
_noiseVar(noiseVar) {}
|
||||
struct RateControlInput {
|
||||
RateControlInput(BandwidthUsage bw_state,
|
||||
uint32_t incoming_bitrate,
|
||||
double noise_var)
|
||||
: bw_state(bw_state),
|
||||
incoming_bitrate(incoming_bitrate),
|
||||
noise_var(noise_var) {}
|
||||
|
||||
BandwidthUsage _bwState;
|
||||
uint32_t _incomingBitRate;
|
||||
double _noiseVar;
|
||||
BandwidthUsage bw_state;
|
||||
uint32_t incoming_bitrate;
|
||||
double noise_var;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_BWE_DEFINES_H_
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
* 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_
|
||||
#define 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_OBSERVER_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -26,4 +26,4 @@ class MockRemoteBitrateObserver : public RemoteBitrateObserver {
|
||||
|
||||
} // 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_
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_
|
||||
#define WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_
|
||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_SEND_TIME_HISTORY_H_
|
||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_SEND_TIME_HISTORY_H_
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -45,4 +45,4 @@ class SendTimeHistory {
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_MODULES_BITRATE_CONTROLLER_SEND_TIME_HISTORY_H_
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_SEND_TIME_HISTORY_H_
|
||||
|
||||
@ -71,8 +71,7 @@ bool InterArrival::ComputeDeltas(uint32_t timestamp,
|
||||
current_timestamp_group_.first_timestamp = timestamp;
|
||||
current_timestamp_group_.timestamp = timestamp;
|
||||
current_timestamp_group_.size = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
current_timestamp_group_.timestamp = LatestTimestamp(
|
||||
current_timestamp_group_.timestamp, timestamp);
|
||||
}
|
||||
|
||||
@ -10,11 +10,13 @@
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/overuse_detector.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/common.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
@ -10,12 +10,13 @@
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/overuse_estimator.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h"
|
||||
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
|
||||
@ -17,7 +17,6 @@ namespace webrtc {
|
||||
class RemoteBitrateEstimatorAbsSendTimeTest :
|
||||
public RemoteBitrateEstimatorTest {
|
||||
public:
|
||||
|
||||
RemoteBitrateEstimatorAbsSendTimeTest() {}
|
||||
virtual void SetUp() {
|
||||
bitrate_estimator_.reset(new RemoteBitrateEstimatorAbsSendTime(
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
@ -28,19 +30,20 @@ enum { kTimestampGroupLengthMs = 5 };
|
||||
static const double kTimestampToMs = 1.0 / 90.0;
|
||||
|
||||
struct RemoteBitrateEstimatorSingleStream::Detector {
|
||||
explicit Detector(int64_t last_packet_time_ms,
|
||||
const OverUseDetectorOptions& options,
|
||||
bool enable_burst_grouping)
|
||||
: last_packet_time_ms(last_packet_time_ms),
|
||||
inter_arrival(90 * kTimestampGroupLengthMs, kTimestampToMs,
|
||||
enable_burst_grouping),
|
||||
estimator(options),
|
||||
detector(options) {}
|
||||
int64_t last_packet_time_ms;
|
||||
InterArrival inter_arrival;
|
||||
OveruseEstimator estimator;
|
||||
OveruseDetector detector;
|
||||
};
|
||||
explicit Detector(int64_t last_packet_time_ms,
|
||||
const OverUseDetectorOptions& options,
|
||||
bool enable_burst_grouping)
|
||||
: last_packet_time_ms(last_packet_time_ms),
|
||||
inter_arrival(90 * kTimestampGroupLengthMs,
|
||||
kTimestampToMs,
|
||||
enable_burst_grouping),
|
||||
estimator(options),
|
||||
detector(options) {}
|
||||
int64_t last_packet_time_ms;
|
||||
InterArrival inter_arrival;
|
||||
OveruseEstimator estimator;
|
||||
OveruseDetector detector;
|
||||
};
|
||||
|
||||
RemoteBitrateEstimatorSingleStream::RemoteBitrateEstimatorSingleStream(
|
||||
RemoteBitrateObserver* observer,
|
||||
|
||||
@ -17,7 +17,6 @@ namespace webrtc {
|
||||
class RemoteBitrateEstimatorSingleTest :
|
||||
public RemoteBitrateEstimatorTest {
|
||||
public:
|
||||
|
||||
RemoteBitrateEstimatorSingleTest() {}
|
||||
virtual void SetUp() {
|
||||
bitrate_estimator_.reset(new RemoteBitrateEstimatorSingleStream(
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_unittest_helper.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
namespace webrtc {
|
||||
@ -383,11 +384,11 @@ void RemoteBitrateEstimatorTest::RateIncreaseReorderingTestHelper(
|
||||
2 * kFrameIntervalAbsSendTime);
|
||||
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(), timestamp,
|
||||
absolute_send_time, true);
|
||||
IncomingPacket(
|
||||
kDefaultSsrc, 1000, clock_.TimeInMilliseconds(),
|
||||
timestamp - 90 * kFrameIntervalMs,
|
||||
AddAbsSendTime(absolute_send_time, -int(kFrameIntervalAbsSendTime)),
|
||||
true);
|
||||
IncomingPacket(kDefaultSsrc, 1000, clock_.TimeInMilliseconds(),
|
||||
timestamp - 90 * kFrameIntervalMs,
|
||||
AddAbsSendTime(absolute_send_time,
|
||||
-static_cast<int>(kFrameIntervalAbsSendTime)),
|
||||
true);
|
||||
}
|
||||
bitrate_estimator_->Process();
|
||||
EXPECT_TRUE(bitrate_observer_->updated());
|
||||
@ -520,8 +521,8 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() {
|
||||
uint32_t timestamp = 0;
|
||||
// Initialize absolute_send_time (24 bits) so that it will definitely wrap
|
||||
// during the test.
|
||||
uint32_t absolute_send_time =
|
||||
AddAbsSendTime((1 << 24), -int(50 * kFrameIntervalAbsSendTime));
|
||||
uint32_t absolute_send_time = AddAbsSendTime(
|
||||
(1 << 24), -static_cast<int>(50 * kFrameIntervalAbsSendTime));
|
||||
// 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.
|
||||
for (int i = 0; i <= 6 * kFramerate; ++i) {
|
||||
@ -556,8 +557,10 @@ void RemoteBitrateEstimatorTest::TestTimestampGroupingTestHelper() {
|
||||
// Increase time until next batch to simulate over-use.
|
||||
clock_.AdvanceTimeMilliseconds(10);
|
||||
timestamp += 90 * kFrameIntervalMs - kTimestampGroupLength;
|
||||
absolute_send_time = AddAbsSendTime(absolute_send_time, AddAbsSendTime(
|
||||
kFrameIntervalAbsSendTime, -int(kTimestampGroupLengthAbsSendTime)));
|
||||
absolute_send_time = AddAbsSendTime(
|
||||
absolute_send_time,
|
||||
AddAbsSendTime(kFrameIntervalAbsSendTime,
|
||||
-static_cast<int>(kTimestampGroupLengthAbsSendTime)));
|
||||
bitrate_estimator_->Process();
|
||||
}
|
||||
EXPECT_TRUE(bitrate_observer_->updated());
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
|
||||
@ -13,8 +13,10 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "webrtc/base/random.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/packet_receiver.h"
|
||||
@ -242,18 +244,20 @@ class BweFeedbackTest
|
||||
: public BweTest,
|
||||
public ::testing::TestWithParam<BandwidthEstimatorType> {
|
||||
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() {}
|
||||
|
||||
protected:
|
||||
void SetUp() override {
|
||||
unsigned int seed = Clock::GetRealTimeClock()->TimeInMicroseconds();
|
||||
#ifndef WEBRTC_WIN
|
||||
seed *= getpid();
|
||||
#endif
|
||||
srand(seed);
|
||||
BweTest::SetUp();
|
||||
}
|
||||
Random random_;
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(BweFeedbackTest);
|
||||
@ -356,7 +360,7 @@ TEST_P(BweFeedbackTest, PacedSelfFairness50msTest) {
|
||||
const int kNumRmcatFlows = 4;
|
||||
int64_t offset_ms[kNumRmcatFlows];
|
||||
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,
|
||||
@ -370,7 +374,7 @@ TEST_P(BweFeedbackTest, PacedSelfFairness500msTest) {
|
||||
const int kNumRmcatFlows = 4;
|
||||
int64_t offset_ms[kNumRmcatFlows];
|
||||
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,
|
||||
@ -384,7 +388,7 @@ TEST_P(BweFeedbackTest, PacedSelfFairness1000msTest) {
|
||||
const int kNumRmcatFlows = 4;
|
||||
int64_t offset_ms[kNumRmcatFlows];
|
||||
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,
|
||||
@ -397,7 +401,7 @@ TEST_P(BweFeedbackTest, TcpFairness50msTest) {
|
||||
|
||||
int64_t offset_ms[2]; // One TCP, one RMCAT flow.
|
||||
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,
|
||||
@ -410,7 +414,7 @@ TEST_P(BweFeedbackTest, TcpFairness500msTest) {
|
||||
|
||||
int64_t offset_ms[2]; // One TCP, one RMCAT flow.
|
||||
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,
|
||||
@ -423,7 +427,7 @@ TEST_P(BweFeedbackTest, TcpFairness1000msTest) {
|
||||
|
||||
int64_t offset_ms[2]; // One TCP, one RMCAT flow.
|
||||
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,
|
||||
|
||||
@ -11,7 +11,10 @@
|
||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_
|
||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_H_
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/test/testsupport/gtest_prod_util.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/packet.h"
|
||||
|
||||
@ -586,7 +586,7 @@ bool TraceBasedDeliveryFilter::Init(const std::string& filename) {
|
||||
return false;
|
||||
}
|
||||
int64_t first_timestamp = -1;
|
||||
while(!feof(trace_file)) {
|
||||
while (!feof(trace_file)) {
|
||||
const size_t kMaxLineLength = 100;
|
||||
char line[kMaxLineLength];
|
||||
if (fgets(line, kMaxLineLength, trace_file)) {
|
||||
@ -680,6 +680,7 @@ VideoSource::VideoSource(int flow_id,
|
||||
frame_period_ms_(1000.0 / fps),
|
||||
bits_per_second_(1000 * kbps),
|
||||
frame_size_bytes_(bits_per_second_ / 8 / fps),
|
||||
random_(0x12345678),
|
||||
flow_id_(flow_id),
|
||||
next_frame_ms_(first_frame_offset_ms),
|
||||
next_frame_rand_ms_(0),
|
||||
@ -713,9 +714,7 @@ void VideoSource::RunFor(int64_t time_ms, Packets* in_out) {
|
||||
const int64_t kRandAmplitude = 2;
|
||||
// A variance picked uniformly from {-1, 0, 1} ms is added to the frame
|
||||
// timestamp.
|
||||
next_frame_rand_ms_ =
|
||||
kRandAmplitude * static_cast<float>(rand()) / RAND_MAX -
|
||||
kRandAmplitude / 2;
|
||||
next_frame_rand_ms_ = kRandAmplitude * (random_.Rand<float>() - 0.5);
|
||||
|
||||
// Ensure frame will not have a negative timestamp.
|
||||
int64_t next_frame_ms =
|
||||
|
||||
@ -17,8 +17,10 @@
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <numeric>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/common.h"
|
||||
@ -44,7 +46,7 @@ class DelayCapHelper;
|
||||
|
||||
class RateCounter {
|
||||
public:
|
||||
RateCounter(int64_t window_size_ms)
|
||||
explicit RateCounter(int64_t window_size_ms)
|
||||
: window_size_us_(1000 * window_size_ms),
|
||||
recently_received_packets_(0),
|
||||
recently_received_bytes_(0),
|
||||
@ -415,6 +417,7 @@ class VideoSource {
|
||||
uint32_t frame_size_bytes_;
|
||||
|
||||
private:
|
||||
Random random_;
|
||||
const int flow_id_;
|
||||
int64_t next_frame_ms_;
|
||||
int64_t next_frame_rand_ms_;
|
||||
|
||||
@ -10,10 +10,10 @@
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h"
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/packet_sender.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace testing {
|
||||
namespace bwe {
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <list>
|
||||
#include <limits>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
@ -149,7 +150,7 @@ class TcpSender : public PacketSender {
|
||||
private:
|
||||
struct InFlight {
|
||||
public:
|
||||
InFlight(const MediaPacket& packet)
|
||||
explicit InFlight(const MediaPacket& packet)
|
||||
: sequence_number(packet.header().sequenceNumber),
|
||||
time_ms(packet.send_time_ms()) {}
|
||||
|
||||
|
||||
@ -10,8 +10,10 @@
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/tools/bwe_rtp.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user