Make the BWE threshold adaptive.
This improves self-fairness and competing for resources with TCP flows. BUG=4711 Review URL: https://codereview.webrtc.org/1151603008 Cr-Commit-Position: refs/heads/master@{#9545}
This commit is contained in:
@ -80,7 +80,7 @@ class LinkedSet {
|
||||
std::list<PacketIdentifierNode*> list_;
|
||||
};
|
||||
|
||||
const int kMinBitrateKbps = 150;
|
||||
const int kMinBitrateKbps = 20;
|
||||
const int kMaxBitrateKbps = 3000;
|
||||
|
||||
class BweSender : public Module {
|
||||
|
||||
@ -254,7 +254,7 @@ void BweTest::RunFairnessTest(BandwidthEstimatorType bwe_type,
|
||||
std::vector<VideoSource*> sources;
|
||||
std::vector<PacketSender*> senders;
|
||||
|
||||
size_t i = 0;
|
||||
size_t i = 1;
|
||||
for (int media_flow : media_flow_ids) {
|
||||
// Streams started 20 seconds apart to give them different advantage when
|
||||
// competing for the bandwidth.
|
||||
|
||||
@ -94,33 +94,6 @@ class RateCounter {
|
||||
std::list<TimeSizePair> window_;
|
||||
};
|
||||
|
||||
Random::Random(uint32_t seed)
|
||||
: a_(0x531FDB97 ^ seed),
|
||||
b_(0x6420ECA8 + seed) {
|
||||
}
|
||||
|
||||
float Random::Rand() {
|
||||
const float kScale = 1.0f / 0xffffffff;
|
||||
float result = kScale * b_;
|
||||
a_ ^= b_;
|
||||
b_ += a_;
|
||||
return result;
|
||||
}
|
||||
|
||||
int Random::Gaussian(int mean, int standard_deviation) {
|
||||
// Creating a Normal distribution variable from two independent uniform
|
||||
// variables based on the Box-Muller transform, which is defined on the
|
||||
// interval (0, 1], hence the mask+add below.
|
||||
const double kPi = 3.14159265358979323846;
|
||||
const double kScale = 1.0 / 0x80000000ul;
|
||||
double u1 = kScale * ((a_ & 0x7ffffffful) + 1);
|
||||
double u2 = kScale * ((b_ & 0x7ffffffful) + 1);
|
||||
a_ ^= b_;
|
||||
b_ += a_;
|
||||
return static_cast<int>(mean + standard_deviation *
|
||||
sqrt(-2 * log(u1)) * cos(2 * kPi * u2));
|
||||
}
|
||||
|
||||
Packet::Packet()
|
||||
: flow_id_(0), creation_time_us_(-1), send_time_us_(-1), payload_size_(0) {
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/packet.h"
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/random.h"
|
||||
#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
|
||||
#include "webrtc/system_wrappers/interface/clock.h"
|
||||
|
||||
@ -142,26 +143,6 @@ template<typename T> class Stats {
|
||||
T max_;
|
||||
};
|
||||
|
||||
class Random {
|
||||
public:
|
||||
explicit Random(uint32_t seed);
|
||||
|
||||
// Return pseudo random number in the interval [0.0, 1.0].
|
||||
float Rand();
|
||||
|
||||
// Normal Distribution.
|
||||
int Gaussian(int mean, int standard_deviation);
|
||||
|
||||
// TODO(solenberg): Random from histogram.
|
||||
// template<typename T> int Distribution(const std::vector<T> histogram) {
|
||||
|
||||
private:
|
||||
uint32_t a_;
|
||||
uint32_t b_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Random);
|
||||
};
|
||||
|
||||
bool IsTimeSorted(const Packets& packets);
|
||||
|
||||
class PacketProcessor;
|
||||
|
||||
41
webrtc/modules/remote_bitrate_estimator/test/random.cc
Normal file
41
webrtc/modules/remote_bitrate_estimator/test/random.cc
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "webrtc/modules/remote_bitrate_estimator/test/random.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
Random::Random(uint32_t seed) : a_(0x531FDB97 ^ seed), b_(0x6420ECA8 + seed) {
|
||||
}
|
||||
|
||||
float Random::Rand() {
|
||||
const float kScale = 1.0f / 0xffffffff;
|
||||
float result = kScale * b_;
|
||||
a_ ^= b_;
|
||||
b_ += a_;
|
||||
return result;
|
||||
}
|
||||
|
||||
int Random::Gaussian(int mean, int standard_deviation) {
|
||||
// Creating a Normal distribution variable from two independent uniform
|
||||
// variables based on the Box-Muller transform, which is defined on the
|
||||
// interval (0, 1], hence the mask+add below.
|
||||
const double kPi = 3.14159265358979323846;
|
||||
const double kScale = 1.0 / 0x80000000ul;
|
||||
double u1 = kScale * ((a_ & 0x7ffffffful) + 1);
|
||||
double u2 = kScale * ((b_ & 0x7ffffffful) + 1);
|
||||
a_ ^= b_;
|
||||
b_ += a_;
|
||||
return static_cast<int>(
|
||||
mean + standard_deviation * sqrt(-2 * log(u1)) * cos(2 * kPi * u2));
|
||||
}
|
||||
} // namespace webrtc
|
||||
40
webrtc/modules/remote_bitrate_estimator/test/random.h
Normal file
40
webrtc/modules/remote_bitrate_estimator/test/random.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_RANDOM_H_
|
||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_RANDOM_H_
|
||||
|
||||
#include "webrtc/typedefs.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class Random {
|
||||
public:
|
||||
explicit Random(uint32_t seed);
|
||||
|
||||
// Return pseudo-random number in the interval [0.0, 1.0].
|
||||
float Rand();
|
||||
|
||||
// Normal Distribution.
|
||||
int Gaussian(int mean, int standard_deviation);
|
||||
|
||||
// TODO(solenberg): Random from histogram.
|
||||
// template<typename T> int Distribution(const std::vector<T> histogram) {
|
||||
|
||||
private:
|
||||
uint32_t a_;
|
||||
uint32_t b_;
|
||||
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Random);
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
#endif // WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_RANDOM_H_
|
||||
Reference in New Issue
Block a user