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}
diff --git a/modules/audio_coding/neteq/tools/audio_loop.cc b/modules/audio_coding/neteq/tools/audio_loop.cc
index b5ad881..972921b 100644
--- a/modules/audio_coding/neteq/tools/audio_loop.cc
+++ b/modules/audio_coding/neteq/tools/audio_loop.cc
@@ -21,16 +21,18 @@
size_t max_loop_length_samples,
size_t block_length_samples) {
FILE* fp = fopen(file_name.c_str(), "rb");
- if (!fp) return false;
+ if (!fp)
+ return false;
- audio_array_.reset(new int16_t[max_loop_length_samples +
- block_length_samples]);
- size_t samples_read = fread(audio_array_.get(), sizeof(int16_t),
- max_loop_length_samples, fp);
+ audio_array_.reset(
+ new int16_t[max_loop_length_samples + block_length_samples]);
+ size_t samples_read =
+ fread(audio_array_.get(), sizeof(int16_t), max_loop_length_samples, fp);
fclose(fp);
// Block length must be shorter than the loop length.
- if (block_length_samples > samples_read) return false;
+ if (block_length_samples > samples_read)
+ return false;
// Add an extra block length of samples to the end of the array, starting
// over again from the beginning of the array. This is done to simplify
@@ -54,6 +56,5 @@
return rtc::ArrayView<const int16_t>(output_ptr, block_length_samples_);
}
-
} // namespace test
} // namespace webrtc
diff --git a/modules/audio_coding/neteq/tools/audio_loop.h b/modules/audio_coding/neteq/tools/audio_loop.h
index abb1a36..876c2d7 100644
--- a/modules/audio_coding/neteq/tools/audio_loop.h
+++ b/modules/audio_coding/neteq/tools/audio_loop.h
@@ -26,10 +26,7 @@
class AudioLoop {
public:
AudioLoop()
- : next_index_(0),
- loop_length_samples_(0),
- block_length_samples_(0) {
- }
+ : next_index_(0), loop_length_samples_(0), block_length_samples_(0) {}
virtual ~AudioLoop() {}
@@ -38,7 +35,8 @@
// greater. Otherwise, the loop length is the same as the file length.
// The audio will be delivered in blocks of |block_length_samples|.
// Returns false if the initialization failed, otherwise true.
- bool Init(const std::string file_name, size_t max_loop_length_samples,
+ bool Init(const std::string file_name,
+ size_t max_loop_length_samples,
size_t block_length_samples);
// Returns a (pointer,size) pair for the next block of audio. The size is
diff --git a/modules/audio_coding/neteq/tools/audio_sink.h b/modules/audio_coding/neteq/tools/audio_sink.h
index 18ac6fc..05e6fe8 100644
--- a/modules/audio_coding/neteq/tools/audio_sink.h
+++ b/modules/audio_coding/neteq/tools/audio_sink.h
@@ -32,9 +32,8 @@
// Writes |audio_frame| to the AudioSink. Returns true if successful,
// otherwise false.
bool WriteAudioFrame(const AudioFrame& audio_frame) {
- return WriteArray(
- audio_frame.data(),
- audio_frame.samples_per_channel_ * audio_frame.num_channels_);
+ return WriteArray(audio_frame.data(), audio_frame.samples_per_channel_ *
+ audio_frame.num_channels_);
}
private:
diff --git a/modules/audio_coding/neteq/tools/input_audio_file.cc b/modules/audio_coding/neteq/tools/input_audio_file.cc
index 330a874..6d11064 100644
--- a/modules/audio_coding/neteq/tools/input_audio_file.cc
+++ b/modules/audio_coding/neteq/tools/input_audio_file.cc
@@ -20,7 +20,9 @@
fp_ = fopen(file_name.c_str(), "rb");
}
-InputAudioFile::~InputAudioFile() { fclose(fp_); }
+InputAudioFile::~InputAudioFile() {
+ fclose(fp_);
+}
bool InputAudioFile::Read(size_t samples, int16_t* destination) {
if (!fp_) {
@@ -73,7 +75,8 @@
return true;
}
-void InputAudioFile::DuplicateInterleaved(const int16_t* source, size_t samples,
+void InputAudioFile::DuplicateInterleaved(const int16_t* source,
+ size_t samples,
size_t channels,
int16_t* destination) {
// Start from the end of |source| and |destination|, and work towards the
diff --git a/modules/audio_coding/neteq/tools/input_audio_file.h b/modules/audio_coding/neteq/tools/input_audio_file.h
index 6bfa369..db5a944 100644
--- a/modules/audio_coding/neteq/tools/input_audio_file.h
+++ b/modules/audio_coding/neteq/tools/input_audio_file.h
@@ -45,8 +45,10 @@
// channels are identical. The output |destination| must have the capacity to
// hold samples * channels elements. Note that |source| and |destination| can
// be the same array (i.e., point to the same address).
- static void DuplicateInterleaved(const int16_t* source, size_t samples,
- size_t channels, int16_t* destination);
+ static void DuplicateInterleaved(const int16_t* source,
+ size_t samples,
+ size_t channels,
+ int16_t* destination);
private:
FILE* fp_;
diff --git a/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc b/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc
index 2c23e5c..3bd218b 100644
--- a/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_external_decoder_test.cc
@@ -8,7 +8,6 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-
#include "modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
#include "api/audio/audio_frame.h"
@@ -32,9 +31,8 @@
}
void NetEqExternalDecoderTest::Init() {
- ASSERT_EQ(NetEq::kOK,
- neteq_->RegisterExternalDecoder(decoder_, codec_, name_,
- kPayloadType));
+ ASSERT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder(decoder_, codec_, name_,
+ kPayloadType));
}
void NetEqExternalDecoderTest::InsertPacket(
diff --git a/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h b/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h
index b8670a3..78f0085 100644
--- a/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h
+++ b/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h
@@ -31,7 +31,7 @@
int sample_rate_hz,
AudioDecoder* decoder);
- virtual ~NetEqExternalDecoderTest() { }
+ virtual ~NetEqExternalDecoderTest() {}
// In Init(), we register the external decoder.
void Init();
diff --git a/modules/audio_coding/neteq/tools/neteq_performance_test.cc b/modules/audio_coding/neteq/tools/neteq_performance_test.cc
index 80aa809..e0dfebf 100644
--- a/modules/audio_coding/neteq/tools/neteq_performance_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_performance_test.cc
@@ -95,9 +95,8 @@
}
// Get next packet.
- packet_input_time_ms = rtp_gen.GetRtpHeader(kPayloadType,
- kInputBlockSizeSamples,
- &rtp_header);
+ packet_input_time_ms = rtp_gen.GetRtpHeader(
+ kPayloadType, kInputBlockSizeSamples, &rtp_header);
input_samples = audio_loop.GetNextBlock();
if (input_samples.empty())
return -1;
diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.cc b/modules/audio_coding/neteq/tools/neteq_quality_test.cc
index 82fa90e..faca895 100644
--- a/modules/audio_coding/neteq/tools/neteq_quality_test.cc
+++ b/modules/audio_coding/neteq/tools/neteq_quality_test.cc
@@ -47,7 +47,9 @@
return true;
}
-DEFINE_string(in_filename, DefaultInFilename().c_str(),
+DEFINE_string(
+ in_filename,
+ DefaultInFilename().c_str(),
"Filename for input audio (specify sample rate with --input_sample_rate, "
"and channels with --channels).");
@@ -55,8 +57,9 @@
DEFINE_int(channels, 1, "Number of channels in input audio.");
-DEFINE_string(out_filename, DefaultOutFilename().c_str(),
- "Name of output audio file.");
+DEFINE_string(out_filename,
+ DefaultOutFilename().c_str(),
+ "Name of output audio file.");
DEFINE_int(runtime_ms, 10000, "Simulated runtime (milliseconds).");
@@ -67,8 +70,9 @@
"Random loss mode: 0--no loss, 1--uniform loss, 2--Gilbert Elliot "
"loss, 3--fixed loss.");
-DEFINE_int(burst_length, 30,
- "Burst length in milliseconds, only valid for Gilbert Elliot loss.");
+DEFINE_int(burst_length,
+ 30,
+ "Burst length in milliseconds, only valid for Gilbert Elliot loss.");
DEFINE_float(drift_factor, 0.0, "Time drift factor.");
@@ -85,21 +89,22 @@
// to achieve the target packet loss rate |loss_rate|, when a packet is not
// lost only if all |units| drawings within the duration of the packet result in
// no-loss.
-static double ProbTrans00Solver(int units, double loss_rate,
+static double ProbTrans00Solver(int units,
+ double loss_rate,
double prob_trans_10) {
if (units == 1)
return prob_trans_10 / (1.0f - loss_rate) - prob_trans_10;
-// 0 == prob_trans_00 ^ (units - 1) + (1 - loss_rate) / prob_trans_10 *
-// prob_trans_00 - (1 - loss_rate) * (1 + 1 / prob_trans_10).
-// There is a unique solution between 0.0 and 1.0, due to the monotonicity and
-// an opposite sign at 0.0 and 1.0.
-// For simplicity, we reformulate the equation as
-// f(x) = x ^ (units - 1) + a x + b.
-// Its derivative is
-// f'(x) = (units - 1) x ^ (units - 2) + a.
-// The derivative is strictly greater than 0 when x is between 0 and 1.
-// We use Newton's method to solve the equation, iteration is
-// x(k+1) = x(k) - f(x) / f'(x);
+ // 0 == prob_trans_00 ^ (units - 1) + (1 - loss_rate) / prob_trans_10 *
+ // prob_trans_00 - (1 - loss_rate) * (1 + 1 / prob_trans_10).
+ // There is a unique solution between 0.0 and 1.0, due to the monotonicity and
+ // an opposite sign at 0.0 and 1.0.
+ // For simplicity, we reformulate the equation as
+ // f(x) = x ^ (units - 1) + a x + b.
+ // Its derivative is
+ // f'(x) = (units - 1) x ^ (units - 2) + a.
+ // The derivative is strictly greater than 0 when x is between 0 and 1.
+ // We use Newton's method to solve the equation, iteration is
+ // x(k+1) = x(k) - f(x) / f'(x);
const double kPrecision = 0.001f;
const int kIterations = 100;
const double a = (1.0f - loss_rate) / prob_trans_10;
@@ -117,7 +122,7 @@
x = 0.0f;
}
f = pow(x, units - 1) + a * x + b;
- iter ++;
+ iter++;
}
return x;
}
@@ -210,9 +215,7 @@
return false;
}
-UniformLoss::UniformLoss(double loss_rate)
- : loss_rate_(loss_rate) {
-}
+UniformLoss::UniformLoss(double loss_rate) : loss_rate_(loss_rate) {}
bool UniformLoss::Lost(int now_ms) {
int drop_this = rand();
@@ -223,8 +226,7 @@
: prob_trans_11_(prob_trans_11),
prob_trans_01_(prob_trans_01),
lost_last_(false),
- uniform_loss_model_(new UniformLoss(0)) {
-}
+ uniform_loss_model_(new UniformLoss(0)) {}
GilbertElliotLoss::~GilbertElliotLoss() {}
@@ -277,8 +279,8 @@
// a full packet duration is drawn with a loss, |unit_loss_rate| fulfills
// (1 - unit_loss_rate) ^ (block_duration_ms_ / kPacketLossTimeUnitMs) ==
// 1 - packet_loss_rate.
- double unit_loss_rate = (1.0f - pow(1.0f - 0.01f * packet_loss_rate_,
- 1.0f / units));
+ double unit_loss_rate =
+ (1.0f - pow(1.0f - 0.01f * packet_loss_rate_, 1.0f / units));
loss_model_.reset(new UniformLoss(unit_loss_rate));
break;
}
@@ -304,8 +306,8 @@
double loss_rate = 0.01f * packet_loss_rate_;
double prob_trans_10 = 1.0f * kPacketLossTimeUnitMs / FLAG_burst_length;
double prob_trans_00 = ProbTrans00Solver(units, loss_rate, prob_trans_10);
- loss_model_.reset(new GilbertElliotLoss(1.0f - prob_trans_10,
- 1.0f - prob_trans_00));
+ loss_model_.reset(
+ new GilbertElliotLoss(1.0f - prob_trans_10, 1.0f - prob_trans_00));
break;
}
case kFixedLoss: {
@@ -347,7 +349,7 @@
// The loop is to make sure that codecs with different block lengths share the
// same packet loss profile.
bool lost = false;
- for (int idx = 0; idx < cycles; idx ++) {
+ for (int idx = 0; idx < cycles; idx++) {
if (loss_model_->Lost(decoded_time_ms_)) {
// The packet will be lost if any of the drawings indicates a loss, but
// the loop has to go on to make sure that codecs with different block
@@ -359,14 +361,10 @@
}
int NetEqQualityTest::Transmit() {
- int packet_input_time_ms =
- rtp_generator_->GetRtpHeader(kPayloadType, in_size_samples_,
- &rtp_header_);
- Log() << "Packet of size "
- << payload_size_bytes_
- << " bytes, for frame at "
- << packet_input_time_ms
- << " ms ";
+ int packet_input_time_ms = rtp_generator_->GetRtpHeader(
+ kPayloadType, in_size_samples_, &rtp_header_);
+ Log() << "Packet of size " << payload_size_bytes_ << " bytes, for frame at "
+ << packet_input_time_ms << " ms ";
if (payload_size_bytes_ > 0) {
if (!PacketLost()) {
int ret = neteq_->InsertPacket(
@@ -411,9 +409,8 @@
decoded_time_ms_) {
ASSERT_TRUE(in_file_->Read(in_size_samples_ * channels_, &in_data_[0]));
payload_.Clear();
- payload_size_bytes_ = EncodeBlock(&in_data_[0],
- in_size_samples_, &payload_,
- max_payload_bytes_);
+ payload_size_bytes_ = EncodeBlock(&in_data_[0], in_size_samples_,
+ &payload_, max_payload_bytes_);
total_payload_size_bytes_ += payload_size_bytes_;
decodable_time_ms_ = Transmit() + block_duration_ms_;
}
@@ -423,8 +420,7 @@
}
}
Log() << "Average bit rate was "
- << 8.0f * total_payload_size_bytes_ / FLAG_runtime_ms
- << " kbps"
+ << 8.0f * total_payload_size_bytes_ / FLAG_runtime_ms << " kbps"
<< std::endl;
}
diff --git a/modules/audio_coding/neteq/tools/neteq_quality_test.h b/modules/audio_coding/neteq/tools/neteq_quality_test.h
index 2b82b0a..b19460c 100644
--- a/modules/audio_coding/neteq/tools/neteq_quality_test.h
+++ b/modules/audio_coding/neteq/tools/neteq_quality_test.h
@@ -36,7 +36,7 @@
class LossModel {
public:
- virtual ~LossModel() {};
+ virtual ~LossModel(){};
virtual bool Lost(int now_ms) = 0;
};
@@ -110,8 +110,10 @@
// |block_size_samples| (samples per channel),
// 2. save the bit stream to |payload| of |max_bytes| bytes in size,
// 3. returns the length of the payload (in bytes),
- virtual int EncodeBlock(int16_t* in_data, size_t block_size_samples,
- rtc::Buffer* payload, size_t max_bytes) = 0;
+ virtual int EncodeBlock(int16_t* in_data,
+ size_t block_size_samples,
+ rtc::Buffer* payload,
+ size_t max_bytes) = 0;
// PacketLost(...) determines weather a packet sent at an indicated time gets
// lost or not.
diff --git a/modules/audio_coding/neteq/tools/neteq_replacement_input.h b/modules/audio_coding/neteq/tools/neteq_replacement_input.h
index 1113001..9ce9b9d 100644
--- a/modules/audio_coding/neteq/tools/neteq_replacement_input.h
+++ b/modules/audio_coding/neteq/tools/neteq_replacement_input.h
@@ -42,7 +42,7 @@
const uint8_t replacement_payload_type_;
const std::set<uint8_t> comfort_noise_types_;
const std::set<uint8_t> forbidden_types_;
- std::unique_ptr<PacketData> packet_; // The next packet to deliver.
+ std::unique_ptr<PacketData> packet_; // The next packet to deliver.
uint32_t last_frame_size_timestamps_ = 960; // Initial guess: 20 ms @ 48 kHz.
};
diff --git a/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
index d69b1a7..673c8fd 100644
--- a/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
+++ b/modules/audio_coding/neteq/tools/neteq_rtpplay.cc
@@ -10,20 +10,20 @@
#include <errno.h>
#include <inttypes.h>
-#include <iostream>
#include <limits.h> // For ULONG_MAX returned by strtoul.
-#include <memory>
#include <stdio.h>
#include <stdlib.h> // For strtoul.
+#include <iostream>
+#include <memory>
#include <string>
#include "modules/audio_coding/neteq/include/neteq.h"
#include "modules/audio_coding/neteq/tools/fake_decode_from_file.h"
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
#include "modules/audio_coding/neteq/tools/neteq_delay_analyzer.h"
-#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
#include "modules/audio_coding/neteq/tools/neteq_packet_source_input.h"
#include "modules/audio_coding/neteq/tools/neteq_replacement_input.h"
+#include "modules/audio_coding/neteq/tools/neteq_stats_getter.h"
#include "modules/audio_coding/neteq/tools/neteq_test.h"
#include "modules/audio_coding/neteq/tools/output_audio_file.h"
#include "modules/audio_coding/neteq/tools/output_wav_file.h"
@@ -71,7 +71,7 @@
bool ValidateSsrcValue(const std::string& str) {
uint32_t dummy_ssrc;
- if (ParseSsrc(str, &dummy_ssrc)) // Value is ok.
+ if (ParseSsrc(str, &dummy_ssrc)) // Value is ok.
return true;
printf("Invalid SSRC: %s\n", str.c_str());
return false;
@@ -106,10 +106,15 @@
DEFINE_int(cn_wb, 98, "RTP payload type for comfort noise (16 kHz)");
DEFINE_int(cn_swb32, 99, "RTP payload type for comfort noise (32 kHz)");
DEFINE_int(cn_swb48, 100, "RTP payload type for comfort noise (48 kHz)");
-DEFINE_bool(codec_map, false, "Prints the mapping between RTP payload type and "
- "codec");
-DEFINE_string(replacement_audio_file, "",
- "A PCM file that will be used to populate ""dummy"" RTP packets");
+DEFINE_bool(codec_map,
+ false,
+ "Prints the mapping between RTP payload type and "
+ "codec");
+DEFINE_string(replacement_audio_file,
+ "",
+ "A PCM file that will be used to populate "
+ "dummy"
+ " RTP packets");
DEFINE_string(ssrc,
"",
"Only use packets with this SSRC (decimal or hex, the latter "
@@ -240,8 +245,8 @@
NetEq* neteq) override {
if (last_ssrc_ && packet.header.ssrc != *last_ssrc_) {
std::cout << "Changing streams from 0x" << std::hex << *last_ssrc_
- << " to 0x" << std::hex << packet.header.ssrc
- << std::dec << " (payload type "
+ << " to 0x" << std::hex << packet.header.ssrc << std::dec
+ << " (payload type "
<< static_cast<int>(packet.header.payloadType) << ")"
<< std::endl;
}
@@ -258,10 +263,13 @@
int RunTest(int argc, char* argv[]) {
std::string program_name = argv[0];
- std::string usage = "Tool for decoding an RTP dump file using NetEq.\n"
- "Run " + program_name + " --help for usage.\n"
- "Example usage:\n" + program_name +
- " input.rtp output.{pcm, wav}\n";
+ std::string usage =
+ "Tool for decoding an RTP dump file using NetEq.\n"
+ "Run " +
+ program_name +
+ " --help for usage.\n"
+ "Example usage:\n" +
+ program_name + " input.rtp output.{pcm, wav}\n";
if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true)) {
return 1;
}
@@ -406,10 +414,8 @@
{FLAG_g722, std::make_pair(NetEqDecoder::kDecoderG722, "g722")},
{FLAG_avt, std::make_pair(NetEqDecoder::kDecoderAVT, "avt")},
{FLAG_avt_16, std::make_pair(NetEqDecoder::kDecoderAVT16kHz, "avt-16")},
- {FLAG_avt_32,
- std::make_pair(NetEqDecoder::kDecoderAVT32kHz, "avt-32")},
- {FLAG_avt_48,
- std::make_pair(NetEqDecoder::kDecoderAVT48kHz, "avt-48")},
+ {FLAG_avt_32, std::make_pair(NetEqDecoder::kDecoderAVT32kHz, "avt-32")},
+ {FLAG_avt_48, std::make_pair(NetEqDecoder::kDecoderAVT48kHz, "avt-48")},
{FLAG_red, std::make_pair(NetEqDecoder::kDecoderRED, "red")},
{FLAG_cn_nb, std::make_pair(NetEqDecoder::kDecoderCNGnb, "cng-nb")},
{FLAG_cn_wb, std::make_pair(NetEqDecoder::kDecoderCNGwb, "cng-wb")},
@@ -440,9 +446,8 @@
std::set<uint8_t> cn_types = std_set_int32_to_uint8(
{FLAG_cn_nb, FLAG_cn_wb, FLAG_cn_swb32, FLAG_cn_swb48});
- std::set<uint8_t> forbidden_types =
- std_set_int32_to_uint8({FLAG_g722, FLAG_red, FLAG_avt,
- FLAG_avt_16, FLAG_avt_32, FLAG_avt_48});
+ std::set<uint8_t> forbidden_types = std_set_int32_to_uint8(
+ {FLAG_g722, FLAG_red, FLAG_avt, FLAG_avt_16, FLAG_avt_32, FLAG_avt_48});
input.reset(new NetEqReplacementInput(std::move(input), replacement_pt,
cn_types, forbidden_types));
diff --git a/modules/audio_coding/neteq/tools/neteq_stats_getter.cc b/modules/audio_coding/neteq/tools/neteq_stats_getter.cc
index 6474e21..58c9ae4 100644
--- a/modules/audio_coding/neteq/tools/neteq_stats_getter.cc
+++ b/modules/audio_coding/neteq/tools/neteq_stats_getter.cc
@@ -26,8 +26,7 @@
rtc::SimpleStringBuilder ss(ss_buf);
ss << "ConcealmentEvent duration_ms:" << duration_ms
<< " event_number:" << concealment_event_number
- << " time_from_previous_event_end_ms:"
- << time_from_previous_event_end_ms;
+ << " time_from_previous_event_end_ms:" << time_from_previous_event_end_ms;
return ss.str();
}
@@ -115,12 +114,10 @@
a.added_zero_samples += b.added_zero_samples;
a.mean_waiting_time_ms += b.mean_waiting_time_ms;
a.median_waiting_time_ms += b.median_waiting_time_ms;
- a.min_waiting_time_ms =
- std::min(a.min_waiting_time_ms,
- static_cast<double>(b.min_waiting_time_ms));
- a.max_waiting_time_ms =
- std::max(a.max_waiting_time_ms,
- static_cast<double>(b.max_waiting_time_ms));
+ a.min_waiting_time_ms = std::min(
+ a.min_waiting_time_ms, static_cast<double>(b.min_waiting_time_ms));
+ a.max_waiting_time_ms = std::max(
+ a.max_waiting_time_ms, static_cast<double>(b.max_waiting_time_ms));
return a;
});
diff --git a/modules/audio_coding/neteq/tools/neteq_stats_getter.h b/modules/audio_coding/neteq/tools/neteq_stats_getter.h
index dbb396a..975393c 100644
--- a/modules/audio_coding/neteq/tools/neteq_stats_getter.h
+++ b/modules/audio_coding/neteq/tools/neteq_stats_getter.h
@@ -69,9 +69,7 @@
double AverageSpeechExpandRate() const;
- NetEqDelayAnalyzer* delay_analyzer() const {
- return delay_analyzer_.get();
- }
+ NetEqDelayAnalyzer* delay_analyzer() const { return delay_analyzer_.get(); }
const std::vector<ConcealmentEvent>& concealment_events() const {
// Do not account for the last concealment event to avoid potential end
diff --git a/modules/audio_coding/neteq/tools/packet.cc b/modules/audio_coding/neteq/tools/packet.cc
index 9505a29..b1a9b64 100644
--- a/modules/audio_coding/neteq/tools/packet.cc
+++ b/modules/audio_coding/neteq/tools/packet.cc
@@ -158,11 +158,10 @@
destination->paddingLength = header_.paddingLength;
destination->headerLength = header_.headerLength;
destination->payload_type_frequency = header_.payload_type_frequency;
- memcpy(&destination->arrOfCSRCs,
- &header_.arrOfCSRCs,
+ memcpy(&destination->arrOfCSRCs, &header_.arrOfCSRCs,
sizeof(header_.arrOfCSRCs));
- memcpy(
- &destination->extension, &header_.extension, sizeof(header_.extension));
+ memcpy(&destination->extension, &header_.extension,
+ sizeof(header_.extension));
}
} // namespace test
diff --git a/modules/audio_coding/neteq/tools/packet.h b/modules/audio_coding/neteq/tools/packet.h
index 94d45c5..2c9a26f 100644
--- a/modules/audio_coding/neteq/tools/packet.h
+++ b/modules/audio_coding/neteq/tools/packet.h
@@ -15,7 +15,7 @@
#include <memory>
#include "api/rtp_headers.h" // NOLINT(build/include)
-#include "common_types.h" // NOLINT(build/include)
+#include "common_types.h" // NOLINT(build/include)
#include "rtc_base/constructormagic.h"
#include "typedefs.h" // NOLINT(build/include)
diff --git a/modules/audio_coding/neteq/tools/packet_unittest.cc b/modules/audio_coding/neteq/tools/packet_unittest.cc
index ce6a3b9..7f3d663 100644
--- a/modules/audio_coding/neteq/tools/packet_unittest.cc
+++ b/modules/audio_coding/neteq/tools/packet_unittest.cc
@@ -28,7 +28,7 @@
rtp_data[0] = 0x80;
rtp_data[1] = static_cast<uint8_t>(payload_type);
rtp_data[2] = (seq_number >> 8) & 0xFF;
- rtp_data[3] = (seq_number) & 0xFF;
+ rtp_data[3] = (seq_number)&0xFF;
rtp_data[4] = timestamp >> 24;
rtp_data[5] = (timestamp >> 16) & 0xFF;
rtp_data[6] = (timestamp >> 8) & 0xFF;
@@ -47,8 +47,8 @@
const uint16_t kSequenceNumber = 4711;
const uint32_t kTimestamp = 47114711;
const uint32_t kSsrc = 0x12345678;
- MakeRtpHeader(
- kPayloadType, kSequenceNumber, kTimestamp, kSsrc, packet_memory);
+ MakeRtpHeader(kPayloadType, kSequenceNumber, kTimestamp, kSsrc,
+ packet_memory);
const double kPacketTime = 1.0;
// Hand over ownership of |packet_memory| to |packet|.
Packet packet(packet_memory, kPacketLengthBytes, kPacketTime);
@@ -75,13 +75,11 @@
const uint16_t kSequenceNumber = 4711;
const uint32_t kTimestamp = 47114711;
const uint32_t kSsrc = 0x12345678;
- MakeRtpHeader(
- kPayloadType, kSequenceNumber, kTimestamp, kSsrc, packet_memory);
+ MakeRtpHeader(kPayloadType, kSequenceNumber, kTimestamp, kSsrc,
+ packet_memory);
const double kPacketTime = 1.0;
// Hand over ownership of |packet_memory| to |packet|.
- Packet packet(packet_memory,
- kPacketLengthBytes,
- kVirtualPacketLengthBytes,
+ Packet packet(packet_memory, kPacketLengthBytes, kVirtualPacketLengthBytes,
kPacketTime);
ASSERT_TRUE(packet.valid_header());
EXPECT_EQ(kPayloadType, packet.header().payloadType);
@@ -140,8 +138,8 @@
const uint16_t kSequenceNumber = 4711;
const uint32_t kTimestamp = 47114711;
const uint32_t kSsrc = 0x12345678;
- MakeRtpHeader(
- kRedPayloadType, kSequenceNumber, kTimestamp, kSsrc, packet_memory);
+ MakeRtpHeader(kRedPayloadType, kSequenceNumber, kTimestamp, kSsrc,
+ packet_memory);
// Create four RED headers.
// Payload types are just the same as the block index the offset is 100 times
// the block index.
@@ -154,8 +152,8 @@
uint32_t timestamp_offset = 100 * i;
int block_length = 10 * i;
bool last_block = (i == kRedBlocks - 1) ? true : false;
- payload_ptr += MakeRedHeader(
- payload_type, timestamp_offset, block_length, last_block, payload_ptr);
+ payload_ptr += MakeRedHeader(payload_type, timestamp_offset, block_length,
+ last_block, payload_ptr);
}
const double kPacketTime = 1.0;
// Hand over ownership of |packet_memory| to |packet|.
@@ -178,8 +176,7 @@
EXPECT_EQ(kRedBlocks, static_cast<int>(red_headers.size()));
int block_index = 0;
for (std::list<RTPHeader*>::reverse_iterator it = red_headers.rbegin();
- it != red_headers.rend();
- ++it) {
+ it != red_headers.rend(); ++it) {
// Reading list from the back, since the extraction puts the main payload
// (which is the last one on wire) first.
RTPHeader* red_block = *it;
diff --git a/modules/audio_coding/neteq/tools/rtp_analyze.cc b/modules/audio_coding/neteq/tools/rtp_analyze.cc
index 12721cc..f939038 100644
--- a/modules/audio_coding/neteq/tools/rtp_analyze.cc
+++ b/modules/audio_coding/neteq/tools/rtp_analyze.cc
@@ -20,10 +20,14 @@
// Define command line flags.
DEFINE_int(red, 117, "RTP payload type for RED");
-DEFINE_int(audio_level, -1, "Extension ID for audio level (RFC 6464); "
- "-1 not to print audio level");
-DEFINE_int(abs_send_time, -1, "Extension ID for absolute sender time; "
- "-1 not to print absolute send time");
+DEFINE_int(audio_level,
+ -1,
+ "Extension ID for audio level (RFC 6464); "
+ "-1 not to print audio level");
+DEFINE_int(abs_send_time,
+ -1,
+ "Extension ID for absolute sender time; "
+ "-1 not to print absolute send time");
DEFINE_bool(help, false, "Print this message");
int main(int argc, char* argv[]) {
@@ -37,8 +41,8 @@
program_name + " input.rtp output.txt\n\n" +
"Output is sent to stdout if no output file is given. " +
"Note that this tool can read files with or without payloads.\n";
- if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) ||
- FLAG_help || (argc != 2 && argc != 3)) {
+ if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true) || FLAG_help ||
+ (argc != 2 && argc != 3)) {
printf("%s", usage.c_str());
if (FLAG_help) {
rtc::FlagList::Print(nullptr, false);
@@ -47,10 +51,11 @@
return 1;
}
- RTC_CHECK(FLAG_red >= 0 && FLAG_red <= 127); // Payload type
- RTC_CHECK(FLAG_audio_level == -1 || // Default
- (FLAG_audio_level > 0 && FLAG_audio_level <= 255)); // Extension ID
- RTC_CHECK(FLAG_abs_send_time == -1 || // Default
+ RTC_CHECK(FLAG_red >= 0 && FLAG_red <= 127); // Payload type
+ RTC_CHECK(FLAG_audio_level == -1 || // Default
+ (FLAG_audio_level > 0 && FLAG_audio_level <= 255)); // Extension ID
+ RTC_CHECK(
+ FLAG_abs_send_time == -1 || // Default
(FLAG_abs_send_time > 0 && FLAG_abs_send_time <= 255)); // Extension ID
printf("Input file: %s\n", argv[1]);
@@ -104,19 +109,14 @@
}
// Write packet data to file. Use virtual_packet_length_bytes so that the
// correct packet sizes are printed also for RTP header-only dumps.
- fprintf(out_file,
- "%5u %10u %10u %5i %5i %2i %#08X",
- packet->header().sequenceNumber,
- packet->header().timestamp,
+ fprintf(out_file, "%5u %10u %10u %5i %5i %2i %#08X",
+ packet->header().sequenceNumber, packet->header().timestamp,
static_cast<unsigned int>(packet->time_ms()),
static_cast<int>(packet->virtual_packet_length_bytes()),
- packet->header().payloadType,
- packet->header().markerBit,
+ packet->header().payloadType, packet->header().markerBit,
packet->header().ssrc);
if (print_audio_level && packet->header().extension.hasAudioLevel) {
- fprintf(out_file,
- " %5u (%1i)",
- packet->header().extension.audioLevel,
+ fprintf(out_file, " %5u (%1i)", packet->header().extension.audioLevel,
packet->header().extension.voiceActivity);
}
if (print_abs_send_time && packet->header().extension.hasAbsoluteSendTime) {
@@ -156,11 +156,8 @@
while (!red_headers.empty()) {
webrtc::RTPHeader* red = red_headers.front();
assert(red);
- fprintf(out_file,
- "* %5u %10u %10u %5i\n",
- red->sequenceNumber,
- red->timestamp,
- static_cast<unsigned int>(packet->time_ms()),
+ fprintf(out_file, "* %5u %10u %10u %5i\n", red->sequenceNumber,
+ red->timestamp, static_cast<unsigned int>(packet->time_ms()),
red->payloadType);
red_headers.pop_front();
delete red;
diff --git a/modules/audio_coding/neteq/tools/rtp_encode.cc b/modules/audio_coding/neteq/tools/rtp_encode.cc
index 66e7a28..1984e3f 100644
--- a/modules/audio_coding/neteq/tools/rtp_encode.cc
+++ b/modules/audio_coding/neteq/tools/rtp_encode.cc
@@ -247,11 +247,16 @@
AudioEncoderCng::Config cng_config;
const auto default_payload_type = [&] {
switch (sample_rate_hz) {
- case 8000: return 13;
- case 16000: return 98;
- case 32000: return 99;
- case 48000: return 100;
- default: RTC_NOTREACHED();
+ case 8000:
+ return 13;
+ case 16000:
+ return 98;
+ case 32000:
+ return 99;
+ case 48000:
+ return 100;
+ default:
+ RTC_NOTREACHED();
}
return 0;
};
diff --git a/modules/audio_coding/neteq/tools/rtp_file_source.cc b/modules/audio_coding/neteq/tools/rtp_file_source.cc
index 0945667..806bba7 100644
--- a/modules/audio_coding/neteq/tools/rtp_file_source.cc
+++ b/modules/audio_coding/neteq/tools/rtp_file_source.cc
@@ -44,8 +44,7 @@
return !!temp_file;
}
-RtpFileSource::~RtpFileSource() {
-}
+RtpFileSource::~RtpFileSource() {}
bool RtpFileSource::RegisterRtpHeaderExtension(RTPExtensionType type,
uint8_t id) {
@@ -82,8 +81,7 @@
}
RtpFileSource::RtpFileSource()
- : PacketSource(),
- parser_(RtpHeaderParser::Create()) {}
+ : PacketSource(), parser_(RtpHeaderParser::Create()) {}
bool RtpFileSource::OpenFile(const std::string& file_name) {
rtp_reader_.reset(RtpFileReader::Create(RtpFileReader::kRtpDump, file_name));
diff --git a/modules/audio_coding/neteq/tools/rtp_generator.cc b/modules/audio_coding/neteq/tools/rtp_generator.cc
index cedd7ae..ab7acdc 100644
--- a/modules/audio_coding/neteq/tools/rtp_generator.cc
+++ b/modules/audio_coding/neteq/tools/rtp_generator.cc
@@ -32,8 +32,8 @@
uint32_t this_send_time = next_send_time_ms_;
assert(samples_per_ms_ > 0);
- next_send_time_ms_ += ((1.0 + drift_factor_) * payload_length_samples) /
- samples_per_ms_;
+ next_send_time_ms_ +=
+ ((1.0 + drift_factor_) * payload_length_samples) / samples_per_ms_;
return this_send_time;
}
@@ -46,8 +46,8 @@
uint32_t TimestampJumpRtpGenerator::GetRtpHeader(uint8_t payload_type,
size_t payload_length_samples,
RTPHeader* rtp_header) {
- uint32_t ret = RtpGenerator::GetRtpHeader(
- payload_type, payload_length_samples, rtp_header);
+ uint32_t ret = RtpGenerator::GetRtpHeader(payload_type,
+ payload_length_samples, rtp_header);
if (timestamp_ - static_cast<uint32_t>(payload_length_samples) <=
jump_from_timestamp_ &&
timestamp_ > jump_from_timestamp_) {
diff --git a/modules/audio_coding/neteq/tools/rtp_generator.h b/modules/audio_coding/neteq/tools/rtp_generator.h
index 3b3cca9..04fdbdd 100644
--- a/modules/audio_coding/neteq/tools/rtp_generator.h
+++ b/modules/audio_coding/neteq/tools/rtp_generator.h
@@ -32,8 +32,7 @@
next_send_time_ms_(start_send_time_ms),
ssrc_(ssrc),
samples_per_ms_(samples_per_ms),
- drift_factor_(0.0) {
- }
+ drift_factor_(0.0) {}
virtual ~RtpGenerator() {}