aboutsummaryrefslogtreecommitdiff
path: root/webrtc/modules/remote_bitrate_estimator/test
diff options
context:
space:
mode:
Diffstat (limited to 'webrtc/modules/remote_bitrate_estimator/test')
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe.h3
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc17
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h2
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h2
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc13
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h19
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc62
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc28
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h28
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/bwe_unittest.cc3
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc5
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h2
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/estimators/nada_unittest.cc7
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc2
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/estimators/tcp.cc2
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc4
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/packet.h2
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc4
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc2
-rw-r--r--webrtc/modules/remote_bitrate_estimator/test/packet_sender.h5
20 files changed, 98 insertions, 114 deletions
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe.h b/webrtc/modules/remote_bitrate_estimator/test/bwe.h
index ef9b3149d7..8d29de2619 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe.h
@@ -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"
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc
index f837638474..9da21c1aaa 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test.cc
@@ -12,9 +12,10 @@
#include <sstream>
+#include "webrtc/base/arraysize.h"
#include "webrtc/base/common.h"
#include "webrtc/base/scoped_ptr.h"
-#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h"
#include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h"
#include "webrtc/modules/remote_bitrate_estimator/test/packet_receiver.h"
@@ -662,7 +663,7 @@ void BweTest::RunSelfFairness(BandwidthEstimatorType bwe_type) {
void BweTest::RunRoundTripTimeFairness(BandwidthEstimatorType bwe_type) {
const int kAllFlowIds[] = {0, 1, 2, 3, 4}; // Five RMCAT flows.
const int64_t kAllOneWayDelayMs[] = {10, 25, 50, 100, 150};
- const size_t kNumFlows = ARRAY_SIZE(kAllFlowIds);
+ const size_t kNumFlows = arraysize(kAllFlowIds);
rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows];
rtc::scoped_ptr<VideoSender> senders[kNumFlows];
rtc::scoped_ptr<MetricRecorder> metric_recorders[kNumFlows];
@@ -774,10 +775,10 @@ void BweTest::RunMultipleShortTcpFairness(
const int kAllTcpFlowIds[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
assert(tcp_starting_times_ms.size() == tcp_file_sizes_bytes.size() &&
- tcp_starting_times_ms.size() == ARRAY_SIZE(kAllTcpFlowIds));
+ tcp_starting_times_ms.size() == arraysize(kAllTcpFlowIds));
- const size_t kNumRmcatFlows = ARRAY_SIZE(kAllRmcatFlowIds);
- const size_t kNumTotalFlows = kNumRmcatFlows + ARRAY_SIZE(kAllTcpFlowIds);
+ const size_t kNumRmcatFlows = arraysize(kAllRmcatFlowIds);
+ const size_t kNumTotalFlows = kNumRmcatFlows + arraysize(kAllTcpFlowIds);
rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumRmcatFlows];
rtc::scoped_ptr<PacketSender> senders[kNumTotalFlows];
@@ -869,7 +870,7 @@ void BweTest::RunMultipleShortTcpFairness(
// During the test, one of the flows is paused and later resumed.
void BweTest::RunPauseResumeFlows(BandwidthEstimatorType bwe_type) {
const int kAllFlowIds[] = {0, 1, 2}; // Three RMCAT flows.
- const size_t kNumFlows = ARRAY_SIZE(kAllFlowIds);
+ const size_t kNumFlows = arraysize(kAllFlowIds);
rtc::scoped_ptr<AdaptiveVideoSource> sources[kNumFlows];
rtc::scoped_ptr<VideoSender> senders[kNumFlows];
@@ -947,7 +948,7 @@ std::vector<int> BweTest::GetFileSizesBytes(int num_files) {
const int kMinKbytes = 100;
const int kMaxKbytes = 1000;
- test::Random random(0x12345678);
+ Random random(0x12345678);
std::vector<int> tcp_file_sizes_bytes;
while (num_files-- > 0) {
@@ -960,7 +961,7 @@ std::vector<int> BweTest::GetFileSizesBytes(int num_files) {
std::vector<int64_t> BweTest::GetStartingTimesMs(int num_files) {
// OFF state behaves as an exp. distribution with mean = 10 seconds.
const float kMeanMs = 10000.0f;
- test::Random random(0x12345678);
+ Random random(0x12345678);
std::vector<int64_t> tcp_starting_times_ms;
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h
index 64dfa85535..b3df7124e3 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h
@@ -12,7 +12,7 @@
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_BASELINEFILE_H_
#include <string>
-#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/include/module_common_types.h"
namespace webrtc {
namespace testing {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h
index 2881eba424..d470324ac3 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h
@@ -16,7 +16,7 @@
#include <string>
#include "webrtc/base/constructormagic.h"
-#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/include/module_common_types.h"
namespace webrtc {
namespace testing {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
index 4574d3d8a1..41bf836c9e 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
@@ -323,7 +323,7 @@ void LossFilter::SetLoss(float loss_percent) {
void LossFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) {
assert(in_out);
for (PacketsIt it = in_out->begin(); it != in_out->end(); ) {
- if (random_.Rand() < loss_fraction_) {
+ if (random_.Rand<float>() < loss_fraction_) {
delete *it;
it = in_out->erase(it);
} else {
@@ -391,7 +391,7 @@ void JitterFilter::SetMaxJitter(int64_t max_jitter_ms) {
}
namespace {
-inline int64_t TruncatedNSigmaGaussian(test::Random* const random,
+inline int64_t TruncatedNSigmaGaussian(Random* const random,
int64_t mean,
int64_t std_dev) {
int64_t gaussian_random = random->Gaussian(mean, std_dev);
@@ -459,7 +459,7 @@ void ReorderFilter::RunFor(int64_t /*time_ms*/, Packets* in_out) {
PacketsIt last_it = in_out->begin();
PacketsIt it = last_it;
while (++it != in_out->end()) {
- if (random_.Rand() < reorder_fraction_) {
+ if (random_.Rand<float>() < reorder_fraction_) {
int64_t t1 = (*last_it)->send_time_us();
int64_t t2 = (*it)->send_time_us();
std::swap(*last_it, *it);
@@ -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 =
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
index 6b24cf30a6..3bb9b95f4b 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
@@ -17,21 +17,23 @@
#include <algorithm>
#include <list>
#include <numeric>
+#include <set>
#include <sstream>
#include <string>
+#include <utility>
#include <vector>
#include "webrtc/base/common.h"
+#include "webrtc/base/random.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
-#include "webrtc/modules/interface/module_common_types.h"
-#include "webrtc/modules/pacing/include/paced_sender.h"
+#include "webrtc/modules/include/module_common_types.h"
+#include "webrtc/modules/pacing/paced_sender.h"
#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/rtp_rtcp/interface/rtp_rtcp_defines.h"
+#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/system_wrappers/include/clock.h"
-#include "webrtc/test/random.h"
namespace webrtc {
@@ -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),
@@ -265,7 +267,7 @@ class LossFilter : public PacketProcessor {
virtual void RunFor(int64_t time_ms, Packets* in_out);
private:
- test::Random random_;
+ Random random_;
float loss_fraction_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(LossFilter);
@@ -299,7 +301,7 @@ class JitterFilter : public PacketProcessor {
int64_t MeanUs();
private:
- test::Random random_;
+ Random random_;
int64_t stddev_jitter_us_;
int64_t last_send_time_us_;
bool reordering_; // False by default.
@@ -318,7 +320,7 @@ class ReorderFilter : public PacketProcessor {
virtual void RunFor(int64_t time_ms, Packets* in_out);
private:
- test::Random random_;
+ Random random_;
float reorder_fraction_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(ReorderFilter);
@@ -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_;
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
index 627260678b..6bdfa847df 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
@@ -22,39 +22,6 @@ namespace webrtc {
namespace testing {
namespace bwe {
-TEST(BweTestFramework_RandomTest, Gaussian) {
- enum {
- kN = 100000,
- kBuckets = 100,
- kMean = 49,
- kStddev = 10
- };
-
- test::Random random(0x12345678);
-
- int buckets[kBuckets] = {0};
- for (int i = 0; i < kN; ++i) {
- int index = random.Gaussian(kMean, kStddev);
- if (index >= 0 && index < kBuckets) {
- buckets[index]++;
- }
- }
-
- const double kPi = 3.14159265358979323846;
- const double kScale = kN / (kStddev * sqrt(2.0 * kPi));
- const double kDiv = -2.0 * kStddev * kStddev;
- double self_corr = 0.0;
- double bucket_corr = 0.0;
- for (int n = 0; n < kBuckets; ++n) {
- double normal_dist = kScale * exp((n - kMean) * (n - kMean) / kDiv);
- self_corr += normal_dist * normal_dist;
- bucket_corr += normal_dist * buckets[n];
- }
- printf("Correlation: %f (random sample), %f (self), %f (quotient)\n",
- bucket_corr, self_corr, bucket_corr / self_corr);
- EXPECT_NEAR(1.0, bucket_corr / self_corr, 0.0004);
-}
-
static bool IsSequenceNumberSorted(const Packets& packets) {
PacketsConstIt last_it = packets.begin();
for (PacketsConstIt it = last_it; it != packets.end(); ++it) {
@@ -533,7 +500,7 @@ TEST(BweTestFramework_JitterFilterTest, Jitter1031) {
TestJitterFilter(1031);
}
-static void TestReorderFilter(uint16_t reorder_percent, uint16_t near_value) {
+static void TestReorderFilter(uint16_t reorder_percent) {
const uint16_t kPacketCount = 10000;
// Generate packets with 10 ms interval.
@@ -559,16 +526,23 @@ static void TestReorderFilter(uint16_t reorder_percent, uint16_t near_value) {
for (auto* packet : packets) {
const MediaPacket* media_packet = static_cast<const MediaPacket*>(packet);
uint16_t sequence_number = media_packet->header().sequenceNumber;
+ // The expected position for sequence number s is in position s-1.
if (sequence_number < last_sequence_number) {
distance += last_sequence_number - sequence_number;
}
last_sequence_number = sequence_number;
}
- // Because reordering is random, we allow a threshold when comparing. The
- // maximum distance a packet can be moved is PacketCount - 1.
- EXPECT_NEAR(
- ((kPacketCount - 1) * reorder_percent) / 100, distance, near_value);
+ // The probability that two elements are swapped is p = reorder_percent / 100.
+ double p = static_cast<double>(reorder_percent) / 100;
+ // The expected number of swaps we perform is p * (PacketCount - 1),
+ // and each swap increases the distance by one.
+ double mean = p * (kPacketCount - 1);
+ // If pair i is chosen to be swapped with probability p, the variance for that
+ // pair is p * (1 - p). Since there are (kPacketCount - 1) independent pairs,
+ // the variance for the number of swaps is (kPacketCount - 1) * p * (1 - p).
+ double std_deviation = sqrt((kPacketCount - 1) * p * (1 - p));
+ EXPECT_NEAR(mean, distance, 3 * std_deviation);
for (auto* packet : packets)
delete packet;
@@ -576,23 +550,23 @@ static void TestReorderFilter(uint16_t reorder_percent, uint16_t near_value) {
TEST(BweTestFramework_ReorderFilterTest, Reorder0) {
// For 0% reordering, no packets should have been moved, so result is exact.
- TestReorderFilter(0, 0);
+ TestReorderFilter(0);
}
TEST(BweTestFramework_ReorderFilterTest, Reorder10) {
- TestReorderFilter(10, 30);
+ TestReorderFilter(10);
}
TEST(BweTestFramework_ReorderFilterTest, Reorder20) {
- TestReorderFilter(20, 20);
+ TestReorderFilter(20);
}
TEST(BweTestFramework_ReorderFilterTest, Reorder50) {
- TestReorderFilter(50, 20);
+ TestReorderFilter(50);
}
TEST(BweTestFramework_ReorderFilterTest, Reorder70) {
- TestReorderFilter(70, 20);
+ TestReorderFilter(70);
}
TEST(BweTestFramework_ReorderFilterTest, Reorder100) {
@@ -600,7 +574,7 @@ TEST(BweTestFramework_ReorderFilterTest, Reorder100) {
// adjacent packets, when the likelihood of a swap is 1.0, a swap will always
// occur, so the stream will be in order except for the first packet, which
// has been moved to the end. Therefore we expect the result to be exact here.
- TestReorderFilter(100.0, 0);
+ TestReorderFilter(100.0);
}
class BweTestFramework_ChokeFilterTest : public ::testing::Test {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
index dcc08d8dde..3a84e81a0b 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
@@ -18,8 +18,8 @@
#include <algorithm>
#include <sstream>
+#include "webrtc/base/platform_thread.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
-#include "webrtc/system_wrappers/include/thread_wrapper.h"
namespace webrtc {
namespace testing {
@@ -57,27 +57,27 @@ Logging* Logging::GetInstance() {
void Logging::SetGlobalContext(uint32_t name) {
CriticalSectionScoped cs(crit_sect_.get());
- thread_map_[ThreadWrapper::GetThreadId()].global_state.tag = ToString(name);
+ thread_map_[rtc::CurrentThreadId()].global_state.tag = ToString(name);
}
void Logging::SetGlobalContext(const std::string& name) {
CriticalSectionScoped cs(crit_sect_.get());
- thread_map_[ThreadWrapper::GetThreadId()].global_state.tag = name;
+ thread_map_[rtc::CurrentThreadId()].global_state.tag = name;
}
void Logging::SetGlobalContext(const char* name) {
CriticalSectionScoped cs(crit_sect_.get());
- thread_map_[ThreadWrapper::GetThreadId()].global_state.tag = name;
+ thread_map_[rtc::CurrentThreadId()].global_state.tag = name;
}
void Logging::SetGlobalEnable(bool enabled) {
CriticalSectionScoped cs(crit_sect_.get());
- thread_map_[ThreadWrapper::GetThreadId()].global_state.enabled = enabled;
+ thread_map_[rtc::CurrentThreadId()].global_state.enabled = enabled;
}
void Logging::Log(const char format[], ...) {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
const State& state = it->second.stack.top();
if (state.enabled) {
@@ -96,7 +96,7 @@ void Logging::Plot(int figure, double value) {
void Logging::Plot(int figure, double value, const std::string& alg_name) {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
const State& state = it->second.stack.top();
std::string label = state.tag + '@' + alg_name;
@@ -119,7 +119,7 @@ void Logging::PlotBar(int figure,
double value,
int flow_id) {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
const State& state = it->second.stack.top();
if (state.enabled) {
@@ -132,7 +132,7 @@ void Logging::PlotBaselineBar(int figure,
double value,
int flow_id) {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
const State& state = it->second.stack.top();
if (state.enabled) {
@@ -148,7 +148,7 @@ void Logging::PlotErrorBar(int figure,
const std::string& error_title,
int flow_id) {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
const State& state = it->second.stack.top();
if (state.enabled) {
@@ -167,7 +167,7 @@ void Logging::PlotLimitErrorBar(int figure,
const std::string& limit_title,
int flow_id) {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
const State& state = it->second.stack.top();
if (state.enabled) {
@@ -182,7 +182,7 @@ void Logging::PlotLabel(int figure,
const std::string& y_label,
int num_flows) {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
const State& state = it->second.stack.top();
if (state.enabled) {
@@ -219,7 +219,7 @@ void Logging::PushState(const std::string& append_to_tag, int64_t timestamp_ms,
bool enabled) {
CriticalSectionScoped cs(crit_sect_.get());
State new_state(append_to_tag, timestamp_ms, enabled);
- ThreadState* thread_state = &thread_map_[ThreadWrapper::GetThreadId()];
+ ThreadState* thread_state = &thread_map_[rtc::CurrentThreadId()];
std::stack<State>* stack = &thread_state->stack;
if (stack->empty()) {
new_state.MergePrevious(thread_state->global_state);
@@ -231,7 +231,7 @@ void Logging::PushState(const std::string& append_to_tag, int64_t timestamp_ms,
void Logging::PopState() {
CriticalSectionScoped cs(crit_sect_.get());
- ThreadMap::iterator it = thread_map_.find(ThreadWrapper::GetThreadId());
+ ThreadMap::iterator it = thread_map_.find(rtc::CurrentThreadId());
assert(it != thread_map_.end());
std::stack<State>* stack = &it->second.stack;
int64_t newest_timestamp_ms = stack->top().timestamp_ms;
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h
index 4115d30c2a..cc7807ba8a 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h
@@ -130,12 +130,12 @@
#define BWE_TEST_LOGGING_GLOBAL_CONTEXT(name) \
do { \
webrtc::testing::bwe::Logging::GetInstance()->SetGlobalContext(name); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_GLOBAL_ENABLE(enabled) \
do { \
webrtc::testing::bwe::Logging::GetInstance()->SetGlobalEnable(enabled); \
- } while (0);
+ } while (0)
#define __BWE_TEST_LOGGING_CONTEXT_NAME(ctx, line) ctx ## line
#define __BWE_TEST_LOGGING_CONTEXT_DECLARE(ctx, line, name, time, enabled) \
@@ -155,36 +155,36 @@
do { \
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->Log(format, _1); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_LOG2(name, format, _1, _2) \
do { \
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->Log(format, _1, _2); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_LOG3(name, format, _1, _2, _3) \
do { \
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->Log(format, _1, _2, _3); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_LOG4(name, format, _1, _2, _3, _4) \
do { \
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->Log(format, _1, _2, _3, \
_4); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_LOG5(name, format, _1, _2, _3, _4, _5) \
do {\
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->Log(format, _1, _2, _3, \
_4, _5); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_PLOT(figure, name, time, value) \
do { \
__BWE_TEST_LOGGING_CONTEXT_DECLARE(__bwe_log_, __PLOT__, name, \
static_cast<int64_t>(time), true); \
webrtc::testing::bwe::Logging::GetInstance()->Plot(figure, value); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_PLOT_WITH_NAME(figure, name, time, value, alg_name) \
do { \
@@ -192,21 +192,21 @@
static_cast<int64_t>(time), true); \
webrtc::testing::bwe::Logging::GetInstance()->Plot(figure, value, \
alg_name); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_BAR(figure, name, value, flow_id) \
do { \
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->PlotBar(figure, name, value, \
flow_id); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_BASELINEBAR(figure, name, value, flow_id) \
do { \
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->PlotBaselineBar( \
figure, name, value, flow_id); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_ERRORBAR(figure, name, value, ylow, yhigh, title, \
flow_id) \
@@ -214,7 +214,7 @@
BWE_TEST_LOGGING_CONTEXT(name); \
webrtc::testing::bwe::Logging::GetInstance()->PlotErrorBar( \
figure, name, value, ylow, yhigh, title, flow_id); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_LIMITERRORBAR( \
figure, name, value, ylow, yhigh, error_title, ymax, limit_title, flow_id) \
@@ -223,14 +223,14 @@
webrtc::testing::bwe::Logging::GetInstance()->PlotLimitErrorBar( \
figure, name, value, ylow, yhigh, error_title, ymax, limit_title, \
flow_id); \
- } while (0);
+ } while (0)
#define BWE_TEST_LOGGING_LABEL(figure, title, y_label, num_flows) \
do { \
BWE_TEST_LOGGING_CONTEXT(title); \
webrtc::testing::bwe::Logging::GetInstance()->PlotLabel( \
figure, title, y_label, num_flows); \
- } while (0);
+ } while (0)
namespace webrtc {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_unittest.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_unittest.cc
index 6b3ce4847c..6245ccd25d 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_unittest.cc
@@ -13,6 +13,7 @@
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
+#include "webrtc/base/arraysize.h"
namespace webrtc {
namespace testing {
@@ -241,7 +242,7 @@ TEST_F(BweReceiverTest, PacketLossDuplicatedPackets) {
// Missing the element 5.
const uint16_t kSequenceNumbers[] = {1, 2, 3, 4, 6, 7, 8};
- const int kNumPackets = ARRAY_SIZE(kSequenceNumbers);
+ const int kNumPackets = arraysize(kSequenceNumbers);
// Insert each sequence number twice.
for (int i = 0; i < 2; ++i) {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc
index d77447f1ea..6166ff8c2d 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.cc
@@ -18,10 +18,11 @@
#include <algorithm>
#include <vector>
+#include "webrtc/base/arraysize.h"
#include "webrtc/base/common.h"
#include "webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
-#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
+#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
namespace webrtc {
namespace testing {
@@ -63,7 +64,7 @@ void NadaBweReceiver::ReceivePacket(int64_t arrival_time_ms,
}
delay_signal_ms_ = delay_ms - baseline_delay_ms_; // Refered as d_n.
- const int kMedian = ARRAY_SIZE(last_delays_ms_);
+ const int kMedian = arraysize(last_delays_ms_);
last_delays_ms_[(last_delays_index_++) % kMedian] = delay_signal_ms_;
int size = std::min(last_delays_index_, kMedian);
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h
index eee90cf463..bf23d09884 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada.h
@@ -20,7 +20,7 @@
#include <list>
#include <map>
-#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
#include "webrtc/voice_engine/channel.h"
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada_unittest.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada_unittest.cc
index a0f56b73b7..51afae1df4 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/nada_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/nada_unittest.cc
@@ -13,6 +13,7 @@
#include <algorithm>
#include <numeric>
+#include "webrtc/base/arraysize.h"
#include "webrtc/base/common.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h"
@@ -357,7 +358,7 @@ TEST_F(NadaReceiverSideTest, FeedbackIncreasingDelay) {
// Baseline delay will be 50 ms.
// Delay signals should be: [0 10 20 30 40 50 60 70] ms.
const int64_t kMedianFilteredDelaysMs[] = {0, 5, 10, 15, 20, 30, 40, 50};
- const int kNumPackets = ARRAY_SIZE(kMedianFilteredDelaysMs);
+ const int kNumPackets = arraysize(kMedianFilteredDelaysMs);
const float kAlpha = 0.1f; // Used for exponential smoothing.
int64_t exp_smoothed_delays_ms[kNumPackets];
@@ -426,7 +427,7 @@ TEST_F(NadaReceiverSideTest, FeedbackWarpedDelay) {
// Delay signals should be: [0 200 400 600 800 1000 1200 1400] ms.
const int64_t kMedianFilteredDelaysMs[] = {
0, 100, 200, 300, 400, 600, 800, 1000};
- const int kNumPackets = ARRAY_SIZE(kMedianFilteredDelaysMs);
+ const int kNumPackets = arraysize(kMedianFilteredDelaysMs);
const float kAlpha = 0.1f; // Used for exponential smoothing.
int64_t exp_smoothed_delays_ms[kNumPackets];
@@ -480,7 +481,7 @@ TEST_F(FilterTest, ExponentialSmoothingConstantArray) {
TEST_F(FilterTest, ExponentialSmoothingInitialPertubation) {
const int64_t kSignal[] = {90000, 0, 0, 0, 0, 0};
- const int kNumElements = ARRAY_SIZE(kSignal);
+ const int kNumElements = arraysize(kSignal);
int64_t exp_smoothed[kNumElements];
ExponentialSmoothingFilter(kSignal, kNumElements, exp_smoothed);
for (int i = 1; i < kNumElements; ++i) {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc
index b18b9f06b9..9599b01933 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc
@@ -17,7 +17,7 @@
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
-#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
+#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
namespace webrtc {
namespace testing {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/estimators/tcp.cc b/webrtc/modules/remote_bitrate_estimator/test/estimators/tcp.cc
index a02abc6ab8..b7e4f971fa 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/estimators/tcp.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/estimators/tcp.cc
@@ -16,7 +16,7 @@
#include "webrtc/base/common.h"
#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
-#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
+#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
namespace webrtc {
namespace testing {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc
index 6202b4a6a3..559757c0eb 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/metric_recorder.cc
@@ -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 {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/packet.h b/webrtc/modules/remote_bitrate_estimator/test/packet.h
index 11885a4544..4a361c4dc2 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/packet.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/packet.h
@@ -16,7 +16,7 @@
#include <vector>
#include "webrtc/common_types.h"
-#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp_defines.h"
+#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
namespace webrtc {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc b/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc
index f70c212af7..793e06421f 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/packet_receiver.cc
@@ -14,10 +14,10 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/common.h"
-#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h"
-#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
+#include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
#include "webrtc/system_wrappers/include/clock.h"
namespace webrtc {
diff --git a/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc b/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc
index f1faa49d7e..3bcbc0a071 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/packet_sender.cc
@@ -15,7 +15,7 @@
#include <sstream>
#include "webrtc/base/checks.h"
-#include "webrtc/modules/interface/module_common_types.h"
+#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
#include "webrtc/modules/remote_bitrate_estimator/test/metric_recorder.h"
diff --git a/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h b/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h
index c42647e2d3..f48ed62f57 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/packet_sender.h
@@ -13,11 +13,12 @@
#include <list>
#include <limits>
+#include <set>
#include <string>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
-#include "webrtc/modules/interface/module.h"
+#include "webrtc/modules/include/module.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe.h"
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.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()) {}