Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -11,9 +11,9 @@
|
||||
// Test to verify correct stereo and multi-channel operation.
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
#include "api/audio/audio_frame.h"
|
||||
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
@ -72,17 +72,17 @@ class NetEqStereoTest : public ::testing::TestWithParam<TestParameters> {
|
||||
input_ = new int16_t[frame_size_samples_];
|
||||
encoded_ = new uint8_t[2 * frame_size_samples_];
|
||||
input_multi_channel_ = new int16_t[frame_size_samples_ * num_channels_];
|
||||
encoded_multi_channel_ = new uint8_t[frame_size_samples_ * 2 *
|
||||
num_channels_];
|
||||
encoded_multi_channel_ =
|
||||
new uint8_t[frame_size_samples_ * 2 * num_channels_];
|
||||
}
|
||||
|
||||
~NetEqStereoTest() {
|
||||
delete neteq_mono_;
|
||||
delete neteq_;
|
||||
delete [] input_;
|
||||
delete [] encoded_;
|
||||
delete [] input_multi_channel_;
|
||||
delete [] encoded_multi_channel_;
|
||||
delete[] input_;
|
||||
delete[] encoded_;
|
||||
delete[] input_multi_channel_;
|
||||
delete[] encoded_multi_channel_;
|
||||
}
|
||||
|
||||
virtual void SetUp() {
|
||||
@ -142,17 +142,15 @@ class NetEqStereoTest : public ::testing::TestWithParam<TestParameters> {
|
||||
if (!input_file_->Read(frame_size_samples_, input_)) {
|
||||
return -1;
|
||||
}
|
||||
payload_size_bytes_ = WebRtcPcm16b_Encode(input_, frame_size_samples_,
|
||||
encoded_);
|
||||
payload_size_bytes_ =
|
||||
WebRtcPcm16b_Encode(input_, frame_size_samples_, encoded_);
|
||||
if (frame_size_samples_ * 2 != payload_size_bytes_) {
|
||||
return -1;
|
||||
}
|
||||
int next_send_time = rtp_generator_mono_.GetRtpHeader(kPayloadTypeMono,
|
||||
frame_size_samples_,
|
||||
&rtp_header_mono_);
|
||||
test::InputAudioFile::DuplicateInterleaved(input_, frame_size_samples_,
|
||||
num_channels_,
|
||||
input_multi_channel_);
|
||||
int next_send_time = rtp_generator_mono_.GetRtpHeader(
|
||||
kPayloadTypeMono, frame_size_samples_, &rtp_header_mono_);
|
||||
test::InputAudioFile::DuplicateInterleaved(
|
||||
input_, frame_size_samples_, num_channels_, input_multi_channel_);
|
||||
multi_payload_size_bytes_ = WebRtcPcm16b_Encode(
|
||||
input_multi_channel_, frame_size_samples_ * num_channels_,
|
||||
encoded_multi_channel_);
|
||||
@ -267,8 +265,7 @@ class NetEqStereoTest : public ::testing::TestWithParam<TestParameters> {
|
||||
|
||||
class NetEqStereoTestNoJitter : public NetEqStereoTest {
|
||||
protected:
|
||||
NetEqStereoTestNoJitter()
|
||||
: NetEqStereoTest() {
|
||||
NetEqStereoTestNoJitter() : NetEqStereoTest() {
|
||||
// Start the sender 100 ms before the receiver to pre-fill the buffer.
|
||||
// This is to avoid doing preemptive expand early in the test.
|
||||
// TODO(hlundin): Mock the decision making instead to control the modes.
|
||||
@ -282,17 +279,15 @@ TEST_P(NetEqStereoTestNoJitter, RunTest) {
|
||||
|
||||
class NetEqStereoTestPositiveDrift : public NetEqStereoTest {
|
||||
protected:
|
||||
NetEqStereoTestPositiveDrift()
|
||||
: NetEqStereoTest(),
|
||||
drift_factor(0.9) {
|
||||
NetEqStereoTestPositiveDrift() : NetEqStereoTest(), drift_factor(0.9) {
|
||||
// Start the sender 100 ms before the receiver to pre-fill the buffer.
|
||||
// This is to avoid doing preemptive expand early in the test.
|
||||
// TODO(hlundin): Mock the decision making instead to control the modes.
|
||||
last_arrival_time_ = -100;
|
||||
}
|
||||
virtual int GetArrivalTime(int send_time) {
|
||||
int arrival_time = last_arrival_time_ +
|
||||
drift_factor * (send_time - last_send_time_);
|
||||
int arrival_time =
|
||||
last_arrival_time_ + drift_factor * (send_time - last_send_time_);
|
||||
last_send_time_ = send_time;
|
||||
last_arrival_time_ = arrival_time;
|
||||
return arrival_time;
|
||||
@ -307,8 +302,7 @@ TEST_P(NetEqStereoTestPositiveDrift, RunTest) {
|
||||
|
||||
class NetEqStereoTestNegativeDrift : public NetEqStereoTestPositiveDrift {
|
||||
protected:
|
||||
NetEqStereoTestNegativeDrift()
|
||||
: NetEqStereoTestPositiveDrift() {
|
||||
NetEqStereoTestNegativeDrift() : NetEqStereoTestPositiveDrift() {
|
||||
drift_factor = 1.1;
|
||||
last_arrival_time_ = 0;
|
||||
}
|
||||
@ -322,10 +316,7 @@ class NetEqStereoTestDelays : public NetEqStereoTest {
|
||||
protected:
|
||||
static const int kDelayInterval = 10;
|
||||
static const int kDelay = 1000;
|
||||
NetEqStereoTestDelays()
|
||||
: NetEqStereoTest(),
|
||||
frame_index_(0) {
|
||||
}
|
||||
NetEqStereoTestDelays() : NetEqStereoTest(), frame_index_(0) {}
|
||||
|
||||
virtual int GetArrivalTime(int send_time) {
|
||||
// Deliver immediately, unless we have a back-log.
|
||||
@ -349,22 +340,16 @@ TEST_P(NetEqStereoTestDelays, RunTest) {
|
||||
class NetEqStereoTestLosses : public NetEqStereoTest {
|
||||
protected:
|
||||
static const int kLossInterval = 10;
|
||||
NetEqStereoTestLosses()
|
||||
: NetEqStereoTest(),
|
||||
frame_index_(0) {
|
||||
}
|
||||
NetEqStereoTestLosses() : NetEqStereoTest(), frame_index_(0) {}
|
||||
|
||||
virtual bool Lost() {
|
||||
return (++frame_index_) % kLossInterval == 0;
|
||||
}
|
||||
virtual bool Lost() { return (++frame_index_) % kLossInterval == 0; }
|
||||
|
||||
// TODO(hlundin): NetEq is not giving bitexact results for these cases.
|
||||
virtual void VerifyOutput(size_t num_samples) {
|
||||
for (size_t i = 0; i < num_samples; ++i) {
|
||||
const int16_t* output_data = output_.data();
|
||||
const int16_t* output_multi_channel_data = output_multi_channel_.data();
|
||||
auto first_channel_sample =
|
||||
output_multi_channel_data[i * num_channels_];
|
||||
auto first_channel_sample = output_multi_channel_data[i * num_channels_];
|
||||
for (size_t j = 0; j < num_channels_; ++j) {
|
||||
const int kErrorMargin = 200;
|
||||
EXPECT_NEAR(output_data[i],
|
||||
@ -384,7 +369,6 @@ TEST_P(NetEqStereoTestLosses, RunTest) {
|
||||
RunTest(100);
|
||||
}
|
||||
|
||||
|
||||
// Creates a list of parameter sets.
|
||||
std::list<TestParameters> GetTestParameters() {
|
||||
std::list<TestParameters> l;
|
||||
@ -412,9 +396,9 @@ std::list<TestParameters> GetTestParameters() {
|
||||
|
||||
// Pretty-printing the test parameters in case of an error.
|
||||
void PrintTo(const TestParameters& p, ::std::ostream* os) {
|
||||
*os << "{frame_size = " << p.frame_size <<
|
||||
", num_channels = " << p.num_channels <<
|
||||
", sample_rate = " << p.sample_rate << "}";
|
||||
*os << "{frame_size = " << p.frame_size
|
||||
<< ", num_channels = " << p.num_channels
|
||||
<< ", sample_rate = " << p.sample_rate << "}";
|
||||
}
|
||||
|
||||
// Instantiate the tests. Each test is instantiated using the function above,
|
||||
|
||||
Reference in New Issue
Block a user