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/acm2/acm_codec_database.cc b/modules/audio_coding/acm2/acm_codec_database.cc
index 4553b52..a322c95 100644
--- a/modules/audio_coding/acm2/acm_codec_database.cc
+++ b/modules/audio_coding/acm2/acm_codec_database.cc
@@ -42,7 +42,7 @@
(rate == 13300)) {
return true;
} else if (((frame_size_samples == 160) || (frame_size_samples == 320)) &&
- (rate == 15200)) {
+ (rate == 15200)) {
return true;
} else {
return false;
@@ -62,55 +62,54 @@
const CodecInst ACMCodecDB::database_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
- {103, "ISAC", 16000, 480, 1, 32000},
-# if (defined(WEBRTC_CODEC_ISAC))
- {104, "ISAC", 32000, 960, 1, 56000},
-# endif
+ {103, "ISAC", 16000, 480, 1, 32000},
+#if (defined(WEBRTC_CODEC_ISAC))
+ {104, "ISAC", 32000, 960, 1, 56000},
#endif
- // Mono
- {107, "L16", 8000, 80, 1, 128000},
- {108, "L16", 16000, 160, 1, 256000},
- {109, "L16", 32000, 320, 1, 512000},
- // Stereo
- {111, "L16", 8000, 80, 2, 128000},
- {112, "L16", 16000, 160, 2, 256000},
- {113, "L16", 32000, 320, 2, 512000},
- // G.711, PCM mu-law and A-law.
- // Mono
- {0, "PCMU", 8000, 160, 1, 64000},
- {8, "PCMA", 8000, 160, 1, 64000},
- // Stereo
- {110, "PCMU", 8000, 160, 2, 64000},
- {118, "PCMA", 8000, 160, 2, 64000},
+#endif
+ // Mono
+ {107, "L16", 8000, 80, 1, 128000},
+ {108, "L16", 16000, 160, 1, 256000},
+ {109, "L16", 32000, 320, 1, 512000},
+ // Stereo
+ {111, "L16", 8000, 80, 2, 128000},
+ {112, "L16", 16000, 160, 2, 256000},
+ {113, "L16", 32000, 320, 2, 512000},
+ // G.711, PCM mu-law and A-law.
+ // Mono
+ {0, "PCMU", 8000, 160, 1, 64000},
+ {8, "PCMA", 8000, 160, 1, 64000},
+ // Stereo
+ {110, "PCMU", 8000, 160, 2, 64000},
+ {118, "PCMA", 8000, 160, 2, 64000},
#ifdef WEBRTC_CODEC_ILBC
- {102, "ILBC", 8000, 240, 1, 13300},
+ {102, "ILBC", 8000, 240, 1, 13300},
#endif
- // Mono
- {9, "G722", 16000, 320, 1, 64000},
- // Stereo
- {119, "G722", 16000, 320, 2, 64000},
+ // Mono
+ {9, "G722", 16000, 320, 1, 64000},
+ // Stereo
+ {119, "G722", 16000, 320, 2, 64000},
#ifdef WEBRTC_CODEC_OPUS
- // Opus internally supports 48, 24, 16, 12, 8 kHz.
- // Mono and stereo.
- {120, "opus", 48000, 960, 2, 64000},
+ // Opus internally supports 48, 24, 16, 12, 8 kHz.
+ // Mono and stereo.
+ {120, "opus", 48000, 960, 2, 64000},
#endif
- // Comfort noise for four different sampling frequencies.
- {13, "CN", 8000, 240, 1, 0},
- {98, "CN", 16000, 480, 1, 0},
- {99, "CN", 32000, 960, 1, 0},
+ // Comfort noise for four different sampling frequencies.
+ {13, "CN", 8000, 240, 1, 0},
+ {98, "CN", 16000, 480, 1, 0},
+ {99, "CN", 32000, 960, 1, 0},
#ifdef ENABLE_48000_HZ
- {100, "CN", 48000, 1440, 1, 0},
+ {100, "CN", 48000, 1440, 1, 0},
#endif
- {106, "telephone-event", 8000, 240, 1, 0},
- {114, "telephone-event", 16000, 240, 1, 0},
- {115, "telephone-event", 32000, 240, 1, 0},
- {116, "telephone-event", 48000, 240, 1, 0},
+ {106, "telephone-event", 8000, 240, 1, 0},
+ {114, "telephone-event", 16000, 240, 1, 0},
+ {115, "telephone-event", 32000, 240, 1, 0},
+ {116, "telephone-event", 48000, 240, 1, 0},
#ifdef WEBRTC_CODEC_RED
- {127, "red", 8000, 0, 1, 0},
+ {127, "red", 8000, 0, 1, 0},
#endif
- // To prevent compile errors due to trailing commas.
- {-1, "Null", -1, -1, 0, -1}
-};
+ // To prevent compile errors due to trailing commas.
+ {-1, "Null", -1, -1, 0, -1}};
// Create database with all codec settings at compile time.
// Each entry needs the following parameters in the given order:
@@ -119,9 +118,9 @@
const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
{2, {480, 960}, 0, 1},
-# if (defined(WEBRTC_CODEC_ISAC))
+#if (defined(WEBRTC_CODEC_ISAC))
{1, {960}, 0, 1},
-# endif
+#endif
#endif
// Mono
{4, {80, 160, 240, 320}, 0, 2},
@@ -146,9 +145,9 @@
// Stereo
{6, {160, 320, 480, 640, 800, 960}, 0, 2},
#ifdef WEBRTC_CODEC_OPUS
- // Opus supports frames shorter than 10ms,
- // but it doesn't help us to use them.
- // Mono and stereo.
+// Opus supports frames shorter than 10ms,
+// but it doesn't help us to use them.
+// Mono and stereo.
#if WEBRTC_OPUS_SUPPORT_120MS_PTIME
{5, {480, 960, 1920, 2880, 5760}, 0, 2},
#else
@@ -171,16 +170,15 @@
{1, {0}, 0, 1},
#endif
// To prevent compile errors due to trailing commas.
- {-1, {-1}, -1, 0}
-};
+ {-1, {-1}, -1, 0}};
// Create a database of all NetEQ decoders at compile time.
const NetEqDecoder ACMCodecDB::neteq_decoders_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
NetEqDecoder::kDecoderISAC,
-# if (defined(WEBRTC_CODEC_ISAC))
+#if (defined(WEBRTC_CODEC_ISAC))
NetEqDecoder::kDecoderISACswb,
-# endif
+#endif
#endif
// Mono
NetEqDecoder::kDecoderPCM16B, NetEqDecoder::kDecoderPCM16Bwb,
@@ -210,10 +208,8 @@
#ifdef ENABLE_48000_HZ
NetEqDecoder::kDecoderCNGswb48kHz,
#endif
- NetEqDecoder::kDecoderAVT,
- NetEqDecoder::kDecoderAVT16kHz,
- NetEqDecoder::kDecoderAVT32kHz,
- NetEqDecoder::kDecoderAVT48kHz,
+ NetEqDecoder::kDecoderAVT, NetEqDecoder::kDecoderAVT16kHz,
+ NetEqDecoder::kDecoderAVT32kHz, NetEqDecoder::kDecoderAVT48kHz,
#ifdef WEBRTC_CODEC_RED
NetEqDecoder::kDecoderRED,
#endif
@@ -260,8 +256,7 @@
int i;
int packet_size_samples;
for (i = 0; i < codec_settings_[codec_id].num_packet_sizes; i++) {
- packet_size_samples =
- codec_settings_[codec_id].packet_sizes_samples[i];
+ packet_size_samples = codec_settings_[codec_id].packet_sizes_samples[i];
if (codec_inst.pacsize == packet_size_samples) {
packet_size_ok = true;
break;
@@ -282,11 +277,10 @@
if (STR_CASE_CMP("isac", codec_inst.plname) == 0) {
return IsISACRateValid(codec_inst.rate) ? codec_id : kInvalidRate;
} else if (STR_CASE_CMP("ilbc", codec_inst.plname) == 0) {
- return IsILBCRateValid(codec_inst.rate, codec_inst.pacsize)
- ? codec_id : kInvalidRate;
+ return IsILBCRateValid(codec_inst.rate, codec_inst.pacsize) ? codec_id
+ : kInvalidRate;
} else if (STR_CASE_CMP("opus", codec_inst.plname) == 0) {
- return IsOpusRateValid(codec_inst.rate)
- ? codec_id : kInvalidRate;
+ return IsOpusRateValid(codec_inst.rate) ? codec_id : kInvalidRate;
}
return database_[codec_id].rate == codec_inst.rate ? codec_id : kInvalidRate;
@@ -298,8 +292,7 @@
// Does not check other codec settings, such as payload type and packet size.
// Returns the id of the codec, or -1 if no match is found.
int ACMCodecDB::CodecId(const CodecInst& codec_inst) {
- return (CodecId(codec_inst.plname, codec_inst.plfreq,
- codec_inst.channels));
+ return (CodecId(codec_inst.plname, codec_inst.plfreq, codec_inst.channels));
}
int ACMCodecDB::CodecId(const char* payload_name,
diff --git a/modules/audio_coding/acm2/acm_codec_database.h b/modules/audio_coding/acm2/acm_codec_database.h
index 81cd4be..8b7c68a 100644
--- a/modules/audio_coding/acm2/acm_codec_database.h
+++ b/modules/audio_coding/acm2/acm_codec_database.h
@@ -31,7 +31,7 @@
// build.
// kMaxNumPacketSize - Maximum number of allowed packet sizes for one codec.
// These might need to be increased if adding a new codec to the database
- static const int kMaxNumCodecs = 50;
+ static const int kMaxNumCodecs = 50;
static const int kMaxNumPacketSize = 6;
// Codec specific settings
diff --git a/modules/audio_coding/acm2/acm_receive_test.cc b/modules/audio_coding/acm2/acm_receive_test.cc
index 473b651..6afc161 100644
--- a/modules/audio_coding/acm2/acm_receive_test.cc
+++ b/modules/audio_coding/acm2/acm_receive_test.cc
@@ -156,8 +156,7 @@
continue;
}
- if (RemapPltypeAndUseThisCodec(my_codec_param.plname,
- my_codec_param.plfreq,
+ if (RemapPltypeAndUseThisCodec(my_codec_param.plname, my_codec_param.plfreq,
my_codec_param.channels,
&my_codec_param.pltype)) {
ASSERT_EQ(true,
@@ -204,8 +203,7 @@
EXPECT_EQ(0,
acm_->IncomingPacket(
packet->payload(),
- static_cast<int32_t>(packet->payload_length_bytes()),
- header))
+ static_cast<int32_t>(packet->payload_length_bytes()), header))
<< "Failure when inserting packet:" << std::endl
<< " PT = " << static_cast<int>(header.header.payloadType) << std::endl
<< " TS = " << header.header.timestamp << std::endl
diff --git a/modules/audio_coding/acm2/acm_receive_test.h b/modules/audio_coding/acm2/acm_receive_test.h
index c7e7da6..83ffcb3 100644
--- a/modules/audio_coding/acm2/acm_receive_test.h
+++ b/modules/audio_coding/acm2/acm_receive_test.h
@@ -11,7 +11,7 @@
#ifndef MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_H_
#define MODULES_AUDIO_CODING_ACM2_ACM_RECEIVE_TEST_H_
-#include <stddef.h> // for size_t
+#include <stddef.h> // for size_t
#include <memory>
#include <string>
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index b61099c..0a88e70 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -231,8 +231,8 @@
if (!audio_decoder) {
ret_val = neteq_->RegisterPayloadType(neteq_decoder, name, payload_type);
} else {
- ret_val = neteq_->RegisterExternalDecoder(
- audio_decoder, neteq_decoder, name, payload_type);
+ ret_val = neteq_->RegisterExternalDecoder(audio_decoder, neteq_decoder,
+ name, payload_type);
}
if (ret_val != NetEq::kOK) {
RTC_LOG(LERROR) << "AcmReceiver::AddCodec " << acm_codec_id
@@ -402,10 +402,9 @@
// the least significant bits. (32-6) bits cover 2^(32-6) = 67108864 ms.
// We masked 6 most significant bits of 32-bit so there is no overflow in
// the conversion from milliseconds to timestamp.
- const uint32_t now_in_ms = static_cast<uint32_t>(
- clock_->TimeInMilliseconds() & 0x03ffffff);
- return static_cast<uint32_t>(
- (decoder_sampling_rate / 1000) * now_in_ms);
+ const uint32_t now_in_ms =
+ static_cast<uint32_t>(clock_->TimeInMilliseconds() & 0x03ffffff);
+ return static_cast<uint32_t>((decoder_sampling_rate / 1000) * now_in_ms);
}
void AcmReceiver::GetDecodingCallStatistics(
diff --git a/modules/audio_coding/acm2/acm_receiver_unittest.cc b/modules/audio_coding/acm2/acm_receiver_unittest.cc
index 7877821..350183b 100644
--- a/modules/audio_coding/acm2/acm_receiver_unittest.cc
+++ b/modules/audio_coding/acm2/acm_receiver_unittest.cc
@@ -30,12 +30,11 @@
namespace {
bool CodecsEqual(const CodecInst& codec_a, const CodecInst& codec_b) {
- if (strcmp(codec_a.plname, codec_b.plname) != 0 ||
- codec_a.plfreq != codec_b.plfreq ||
- codec_a.pltype != codec_b.pltype ||
- codec_b.channels != codec_a.channels)
- return false;
- return true;
+ if (strcmp(codec_a.plname, codec_b.plname) != 0 ||
+ codec_a.plfreq != codec_b.plfreq || codec_a.pltype != codec_b.pltype ||
+ codec_b.channels != codec_a.channels)
+ return false;
+ return true;
}
struct CodecIdInst {
@@ -115,7 +114,7 @@
}
template <size_t N>
- void AddSetOfCodecs(const RentACodec::CodecId(&ids)[N]) {
+ void AddSetOfCodecs(const RentACodec::CodecId (&ids)[N]) {
for (auto id : ids) {
const auto i = RentACodec::CodecIndexFromId(id);
ASSERT_TRUE(i);
@@ -186,13 +185,13 @@
CodecInst my_codec;
if (n & 0x1) {
// Codecs with odd index should match the reference.
- EXPECT_EQ(0, receiver_->DecoderByPayloadType(codecs_[n].pltype,
- &my_codec));
+ EXPECT_EQ(0,
+ receiver_->DecoderByPayloadType(codecs_[n].pltype, &my_codec));
EXPECT_TRUE(CodecsEqual(codecs_[n], my_codec));
} else {
// Codecs with even index are not registered.
- EXPECT_EQ(-1, receiver_->DecoderByPayloadType(codecs_[n].pltype,
- &my_codec));
+ EXPECT_EQ(-1,
+ receiver_->DecoderByPayloadType(codecs_[n].pltype, &my_codec));
}
}
}
@@ -326,7 +325,8 @@
// Expect the first output timestamp to be 5*fs/8000 samples before the
// first inserted timestamp (because of NetEq's look-ahead). (This value is
// defined in Expand::overlap_length_.)
- uint32_t expected_output_ts = last_packet_send_timestamp_ -
+ uint32_t expected_output_ts =
+ last_packet_send_timestamp_ -
rtc::CheckedDivExact(5 * output_sample_rate_hz, 8000);
AudioFrame frame;
diff --git a/modules/audio_coding/acm2/acm_resampler.cc b/modules/audio_coding/acm2/acm_resampler.cc
index b97ced2..c0b2064 100644
--- a/modules/audio_coding/acm2/acm_resampler.cc
+++ b/modules/audio_coding/acm2/acm_resampler.cc
@@ -19,11 +19,9 @@
namespace webrtc {
namespace acm2 {
-ACMResampler::ACMResampler() {
-}
+ACMResampler::ACMResampler() {}
-ACMResampler::~ACMResampler() {
-}
+ACMResampler::~ACMResampler() {}
int ACMResampler::Resample10Msec(const int16_t* in_audio,
int in_freq_hz,
diff --git a/modules/audio_coding/acm2/acm_send_test.cc b/modules/audio_coding/acm2/acm_send_test.cc
index 09a6c80..b1a3e98 100644
--- a/modules/audio_coding/acm2/acm_send_test.cc
+++ b/modules/audio_coding/acm2/acm_send_test.cc
@@ -95,10 +95,9 @@
RTC_CHECK(audio_source_->Read(input_block_size_samples_,
input_frame_.mutable_data()));
if (input_frame_.num_channels_ > 1) {
- InputAudioFile::DuplicateInterleaved(input_frame_.data(),
- input_block_size_samples_,
- input_frame_.num_channels_,
- input_frame_.mutable_data());
+ InputAudioFile::DuplicateInterleaved(
+ input_frame_.data(), input_block_size_samples_,
+ input_frame_.num_channels_, input_frame_.mutable_data());
}
data_to_send_ = false;
RTC_CHECK_GE(acm_->Add10MsData(input_frame_), 0);
@@ -138,7 +137,7 @@
packet_memory[0] = 0x80;
packet_memory[1] = static_cast<uint8_t>(payload_type_);
packet_memory[2] = (sequence_number_ >> 8) & 0xFF;
- packet_memory[3] = (sequence_number_) & 0xFF;
+ packet_memory[3] = (sequence_number_)&0xFF;
packet_memory[4] = (timestamp_ >> 24) & 0xFF;
packet_memory[5] = (timestamp_ >> 16) & 0xFF;
packet_memory[6] = (timestamp_ >> 8) & 0xFF;
@@ -152,8 +151,7 @@
++sequence_number_;
// Copy the payload data.
- memcpy(packet_memory + kRtpHeaderSize,
- &last_payload_vec_[0],
+ memcpy(packet_memory + kRtpHeaderSize, &last_payload_vec_[0],
last_payload_vec_.size());
std::unique_ptr<Packet> packet(
new Packet(packet_memory, allocated_bytes, clock_.TimeInMilliseconds()));
diff --git a/modules/audio_coding/acm2/audio_coding_module.cc b/modules/audio_coding/acm2/audio_coding_module.cc
index 2d8827c..7f652a2 100644
--- a/modules/audio_coding/acm2/audio_coding_module.cc
+++ b/modules/audio_coding/acm2/audio_coding_module.cc
@@ -323,9 +323,10 @@
if (!frame.muted()) {
const int16_t* frame_data = frame.data();
for (size_t n = 0; n < frame.samples_per_channel_; ++n) {
- out_buff[n] = static_cast<int16_t>(
- (static_cast<int32_t>(frame_data[2 * n]) +
- static_cast<int32_t>(frame_data[2 * n + 1])) >> 1);
+ out_buff[n] =
+ static_cast<int16_t>((static_cast<int32_t>(frame_data[2 * n]) +
+ static_cast<int32_t>(frame_data[2 * n + 1])) >>
+ 1);
}
} else {
std::fill(out_buff, out_buff + frame.samples_per_channel_, 0);
@@ -472,7 +473,7 @@
if (!HaveValidEncoder("Process"))
return -1;
- if(!first_frame_) {
+ if (!first_frame_) {
RTC_DCHECK(IsNewerTimestamp(input_data.input_timestamp, last_timestamp_))
<< "Time should not move backwards";
}
@@ -493,9 +494,10 @@
// Clear the buffer before reuse - encoded data will get appended.
encode_buffer_.Clear();
encoded_info = encoder_stack_->Encode(
- rtp_timestamp, rtc::ArrayView<const int16_t>(
- input_data.audio, input_data.audio_channel *
- input_data.length_per_channel),
+ rtp_timestamp,
+ rtc::ArrayView<const int16_t>(
+ input_data.audio,
+ input_data.audio_channel * input_data.length_per_channel),
&encode_buffer_);
bitrate_logger_.MaybeLog(encoder_stack_->GetTargetBitrate() / 1000);
@@ -767,7 +769,6 @@
expected_in_ts_ = in_frame.timestamp_;
}
-
if (!down_mix && !resample) {
// No pre-processing is required.
if (expected_in_ts_ == expected_codec_ts_) {
@@ -793,8 +794,8 @@
if (down_mix) {
// If a resampling is required the output of a down-mix is written into a
// local buffer, otherwise, it will be written to the output frame.
- int16_t* dest_ptr_audio = resample ?
- audio : preprocess_frame_.mutable_data();
+ int16_t* dest_ptr_audio =
+ resample ? audio : preprocess_frame_.mutable_data();
if (DownMix(in_frame, WEBRTC_10MS_PCM_AUDIO, dest_ptr_audio) < 0)
return -1;
preprocess_frame_.num_channels_ = 1;
@@ -912,7 +913,8 @@
}
// Get VAD/DTX settings.
-int AudioCodingModuleImpl::VAD(bool* dtx_enabled, bool* vad_enabled,
+int AudioCodingModuleImpl::VAD(bool* dtx_enabled,
+ bool* vad_enabled,
ACMVADMode* mode) const {
rtc::CritScope lock(&acm_crit_sect_);
const auto* sp = encoder_factory_->codec_manager.GetStackParams();
@@ -1229,7 +1231,7 @@
}
void AudioCodingModuleImpl::GetDecodingCallStatistics(
- AudioDecodingCallStats* call_stats) const {
+ AudioDecodingCallStats* call_stats) const {
receiver_.GetDecodingCallStatistics(call_stats);
}
diff --git a/modules/audio_coding/acm2/audio_coding_module_unittest.cc b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
index e16d54a..7592300 100644
--- a/modules/audio_coding/acm2/audio_coding_module_unittest.cc
+++ b/modules/audio_coding/acm2/audio_coding_module_unittest.cc
@@ -425,19 +425,12 @@
const struct {
int ix;
FrameType type;
- } expectation[] = {{2, kAudioFrameCN},
- {5, kEmptyFrame},
- {8, kEmptyFrame},
- {11, kAudioFrameCN},
- {14, kEmptyFrame},
- {17, kEmptyFrame},
- {20, kAudioFrameCN},
- {23, kEmptyFrame},
- {26, kEmptyFrame},
- {29, kEmptyFrame},
- {32, kAudioFrameCN},
- {35, kEmptyFrame},
- {38, kEmptyFrame}};
+ } expectation[] = {
+ {2, kAudioFrameCN}, {5, kEmptyFrame}, {8, kEmptyFrame},
+ {11, kAudioFrameCN}, {14, kEmptyFrame}, {17, kEmptyFrame},
+ {20, kAudioFrameCN}, {23, kEmptyFrame}, {26, kEmptyFrame},
+ {29, kEmptyFrame}, {32, kAudioFrameCN}, {35, kEmptyFrame},
+ {38, kEmptyFrame}};
for (int i = 0; i < kLoops; ++i) {
int num_calls_before = packet_cb_.num_calls();
EXPECT_EQ(i / blocks_per_packet, num_calls_before);
@@ -686,10 +679,8 @@
last_packet_number_ = num_calls;
}
ASSERT_GT(last_payload_vec_.size(), 0u);
- ASSERT_EQ(
- 0,
- acm_->IncomingPacket(
- &last_payload_vec_[0], last_payload_vec_.size(), rtp_header_));
+ ASSERT_EQ(0, acm_->IncomingPacket(&last_payload_vec_[0],
+ last_payload_vec_.size(), rtp_header_));
}
void InsertAudio() override {
@@ -819,9 +810,8 @@
// Encode new frame.
uint32_t input_timestamp = rtp_header_.header.timestamp;
while (info.encoded_bytes == 0) {
- info =
- isac_encoder_->Encode(input_timestamp, audio_loop_.GetNextBlock(),
- &encoded);
+ info = isac_encoder_->Encode(input_timestamp,
+ audio_loop_.GetNextBlock(), &encoded);
input_timestamp += 160; // 10 ms at 16 kHz.
}
EXPECT_EQ(rtp_header_.header.timestamp + kPacketSizeSamples,
@@ -1094,11 +1084,12 @@
rtc::scoped_refptr<rtc::RefCountedObject<ADFactory>> factory(
new rtc::RefCountedObject<ADFactory>);
- Run(48000, PlatformChecksum("5955e31373828969de7fb308fb58a84e",
- "83c0eca235b1a806426ff6ca8655cdf7",
- "1126a8c03d1ebc6aa7348b9c541e2082",
- "bd44bf97e7899186532f91235cef444d",
- "9d092dbc96e7ef6870b78c1056e87315"),
+ Run(48000,
+ PlatformChecksum("5955e31373828969de7fb308fb58a84e",
+ "83c0eca235b1a806426ff6ca8655cdf7",
+ "1126a8c03d1ebc6aa7348b9c541e2082",
+ "bd44bf97e7899186532f91235cef444d",
+ "9d092dbc96e7ef6870b78c1056e87315"),
factory, [](AudioCodingModule* acm) {
acm->RegisterReceiveCodec(0, {"MockPCMu", 8000, 1});
});
@@ -1154,11 +1145,8 @@
int frame_size_rtp_timestamps) {
payload_type_ = payload_type;
frame_size_rtp_timestamps_ = frame_size_rtp_timestamps;
- return send_test_->RegisterCodec(payload_name,
- sampling_freq_hz,
- channels,
- payload_type,
- frame_size_samples);
+ return send_test_->RegisterCodec(payload_name, sampling_freq_hz, channels,
+ payload_type, frame_size_samples);
}
bool RegisterExternalSendCodec(AudioEncoder* external_speech_encoder,
@@ -1257,11 +1245,8 @@
int codec_frame_size_samples,
int codec_frame_size_rtp_timestamps) {
ASSERT_TRUE(SetUpSender());
- ASSERT_TRUE(RegisterSendCodec(codec_name,
- codec_sample_rate_hz,
- channels,
- payload_type,
- codec_frame_size_samples,
+ ASSERT_TRUE(RegisterSendCodec(codec_name, codec_sample_rate_hz, channels,
+ payload_type, codec_frame_size_samples,
codec_frame_size_rtp_timestamps));
}
@@ -1342,82 +1327,62 @@
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_8000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80));
- Run("de4a98e1406f8b798d99cd0704e862e2",
- "c1edd36339ce0326cc4550041ad719a0",
- 100,
- test::AcmReceiveTestOldApi::kMonoOutput);
+ Run("de4a98e1406f8b798d99cd0704e862e2", "c1edd36339ce0326cc4550041ad719a0",
+ 100, test::AcmReceiveTestOldApi::kMonoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_16000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 16000, 1, 108, 160, 160));
- Run("ae646d7b68384a1269cc080dd4501916",
- "ad786526383178b08d80d6eee06e9bad",
- 100,
- test::AcmReceiveTestOldApi::kMonoOutput);
+ Run("ae646d7b68384a1269cc080dd4501916", "ad786526383178b08d80d6eee06e9bad",
+ 100, test::AcmReceiveTestOldApi::kMonoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_32000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 32000, 1, 109, 320, 320));
- Run("7fe325e8fbaf755e3c5df0b11a4774fb",
- "5ef82ea885e922263606c6fdbc49f651",
- 100,
- test::AcmReceiveTestOldApi::kMonoOutput);
+ Run("7fe325e8fbaf755e3c5df0b11a4774fb", "5ef82ea885e922263606c6fdbc49f651",
+ 100, test::AcmReceiveTestOldApi::kMonoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_8000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 2, 111, 80, 80));
- Run("fb263b74e7ac3de915474d77e4744ceb",
- "62ce5adb0d4965d0a52ec98ae7f98974",
- 100,
- test::AcmReceiveTestOldApi::kStereoOutput);
+ Run("fb263b74e7ac3de915474d77e4744ceb", "62ce5adb0d4965d0a52ec98ae7f98974",
+ 100, test::AcmReceiveTestOldApi::kStereoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_16000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 16000, 2, 112, 160, 160));
- Run("d09e9239553649d7ac93e19d304281fd",
- "41ca8edac4b8c71cd54fd9f25ec14870",
- 100,
- test::AcmReceiveTestOldApi::kStereoOutput);
+ Run("d09e9239553649d7ac93e19d304281fd", "41ca8edac4b8c71cd54fd9f25ec14870",
+ 100, test::AcmReceiveTestOldApi::kStereoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcm16_stereo_32000khz_10ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 32000, 2, 113, 320, 320));
- Run("5f025d4f390982cc26b3d92fe02e3044",
- "50e58502fb04421bf5b857dda4c96879",
- 100,
- test::AcmReceiveTestOldApi::kStereoOutput);
+ Run("5f025d4f390982cc26b3d92fe02e3044", "50e58502fb04421bf5b857dda4c96879",
+ 100, test::AcmReceiveTestOldApi::kStereoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcmu_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMU", 8000, 1, 0, 160, 160));
- Run("81a9d4c0bb72e9becc43aef124c981e9",
- "8f9b8750bd80fe26b6cbf6659b89f0f9",
- 50,
- test::AcmReceiveTestOldApi::kMonoOutput);
+ Run("81a9d4c0bb72e9becc43aef124c981e9", "8f9b8750bd80fe26b6cbf6659b89f0f9",
+ 50, test::AcmReceiveTestOldApi::kMonoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcma_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMA", 8000, 1, 8, 160, 160));
- Run("39611f798969053925a49dc06d08de29",
- "6ad745e55aa48981bfc790d0eeef2dd1",
- 50,
- test::AcmReceiveTestOldApi::kMonoOutput);
+ Run("39611f798969053925a49dc06d08de29", "6ad745e55aa48981bfc790d0eeef2dd1",
+ 50, test::AcmReceiveTestOldApi::kMonoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcmu_stereo_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMU", 8000, 2, 110, 160, 160));
- Run("437bec032fdc5cbaa0d5175430af7b18",
- "60b6f25e8d1e74cb679cfe756dd9bca5",
- 50,
- test::AcmReceiveTestOldApi::kStereoOutput);
+ Run("437bec032fdc5cbaa0d5175430af7b18", "60b6f25e8d1e74cb679cfe756dd9bca5",
+ 50, test::AcmReceiveTestOldApi::kStereoOutput);
}
TEST_F(AcmSenderBitExactnessOldApi, Pcma_stereo_20ms) {
ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMA", 8000, 2, 118, 160, 160));
- Run("a5c6d83c5b7cedbeff734238220a4b0c",
- "92b282c83efd20e7eeef52ba40842cf7",
- 50,
- test::AcmReceiveTestOldApi::kStereoOutput);
+ Run("a5c6d83c5b7cedbeff734238220a4b0c", "92b282c83efd20e7eeef52ba40842cf7",
+ 50, test::AcmReceiveTestOldApi::kStereoOutput);
}
#if defined(WEBRTC_ANDROID)
@@ -1740,11 +1705,11 @@
if (packet_counter == nr_packets / 2)
send_test_->acm()->SetBitRate(target_bitrate_bps);
if (packet_counter < nr_packets / 2)
- nr_bytes_before += rtc::checked_cast<int>(
- next_packet->payload_length_bytes());
+ nr_bytes_before +=
+ rtc::checked_cast<int>(next_packet->payload_length_bytes());
else
- nr_bytes_after += rtc::checked_cast<int>(
- next_packet->payload_length_bytes());
+ nr_bytes_after +=
+ rtc::checked_cast<int>(next_packet->payload_length_bytes());
packet_counter++;
}
// Check that bitrate is 80-120 percent of expected value.
@@ -1811,12 +1776,10 @@
.WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::GetTargetBitrate));
EXPECT_CALL(mock_encoder, EncodeImpl(_, _, _))
.Times(AtLeast(1))
- .WillRepeatedly(Invoke(&encoder,
- static_cast<
- AudioEncoder::EncodedInfo(AudioEncoder::*)(
- uint32_t,
- rtc::ArrayView<const int16_t>,
- rtc::Buffer*)>(&AudioEncoderPcmU::Encode)));
+ .WillRepeatedly(Invoke(
+ &encoder, static_cast<AudioEncoder::EncodedInfo (AudioEncoder::*)(
+ uint32_t, rtc::ArrayView<const int16_t>, rtc::Buffer*)>(
+ &AudioEncoderPcmU::Encode)));
EXPECT_CALL(mock_encoder, SetFec(_))
.Times(AtLeast(1))
.WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::SetFec));
@@ -1866,11 +1829,7 @@
// this class.
test::AudioSinkFork output(this, &output_file);
test::AcmReceiveTestToggleOutputFreqOldApi receive_test(
- this,
- &output,
- output_freq_1,
- output_freq_2,
- toggle_period_ms,
+ this, &output, output_freq_1, output_freq_2, toggle_period_ms,
test::AcmReceiveTestOldApi::kMonoOutput);
ASSERT_NO_FATAL_FAILURE(receive_test.RegisterDefaultCodecs());
output_freq_2_ = output_freq_2;
diff --git a/modules/audio_coding/acm2/call_statistics_unittest.cc b/modules/audio_coding/acm2/call_statistics_unittest.cc
index 77c3863..528708f 100644
--- a/modules/audio_coding/acm2/call_statistics_unittest.cc
+++ b/modules/audio_coding/acm2/call_statistics_unittest.cc
@@ -52,6 +52,3 @@
} // namespace acm2
} // namespace webrtc
-
-
-
diff --git a/modules/audio_coding/acm2/rent_a_codec_unittest.cc b/modules/audio_coding/acm2/rent_a_codec_unittest.cc
index ca469e7..fd3329c 100644
--- a/modules/audio_coding/acm2/rent_a_codec_unittest.cc
+++ b/modules/audio_coding/acm2/rent_a_codec_unittest.cc
@@ -54,8 +54,7 @@
int expected_send_even_if_empty) {
rtc::Buffer out;
AudioEncoder::EncodedInfo encoded_info;
- encoded_info =
- encoder_->Encode(timestamp_, kZeroData, &out);
+ encoded_info = encoder_->Encode(timestamp_, kZeroData, &out);
timestamp_ += kDataLengthSamples;
EXPECT_TRUE(encoded_info.redundant.empty());
EXPECT_EQ(expected_out_length, encoded_info.encoded_bytes);
@@ -132,9 +131,8 @@
{
::testing::InSequence s;
info.encoded_timestamp = 0;
- EXPECT_CALL(
- *external_encoder,
- EncodeImpl(0, rtc::ArrayView<const int16_t>(audio), &encoded))
+ EXPECT_CALL(*external_encoder,
+ EncodeImpl(0, rtc::ArrayView<const int16_t>(audio), &encoded))
.WillOnce(Return(info));
EXPECT_CALL(marker, Mark("A"));
EXPECT_CALL(marker, Mark("B"));