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/pc/statscollector.cc b/pc/statscollector.cc
index 8807e61..fc00189 100644
--- a/pc/statscollector.cc
+++ b/pc/statscollector.cc
@@ -40,7 +40,7 @@
const char* STATSREPORT_ADAPTER_TYPE_VPN = "vpn";
const char* STATSREPORT_ADAPTER_TYPE_LOOPBACK = "loopback";
-template<typename ValueType>
+template <typename ValueType>
struct TypeForAdd {
const StatsReport::StatsValueName name;
const ValueType& value;
@@ -133,37 +133,36 @@
void ExtractStats(const cricket::VoiceReceiverInfo& info, StatsReport* report) {
ExtractCommonReceiveProperties(info, report);
const FloatForAdd floats[] = {
- { StatsReport::kStatsValueNameExpandRate, info.expand_rate },
- { StatsReport::kStatsValueNameSecondaryDecodedRate,
- info.secondary_decoded_rate },
- { StatsReport::kStatsValueNameSecondaryDiscardedRate,
- info.secondary_discarded_rate },
- { StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate },
- { StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate },
- { StatsReport::kStatsValueNamePreemptiveExpandRate,
- info.preemptive_expand_rate },
- { StatsReport::kStatsValueNameTotalAudioEnergy, info.total_output_energy },
- { StatsReport::kStatsValueNameTotalSamplesDuration,
- info.total_output_duration }
- };
+ {StatsReport::kStatsValueNameExpandRate, info.expand_rate},
+ {StatsReport::kStatsValueNameSecondaryDecodedRate,
+ info.secondary_decoded_rate},
+ {StatsReport::kStatsValueNameSecondaryDiscardedRate,
+ info.secondary_discarded_rate},
+ {StatsReport::kStatsValueNameSpeechExpandRate, info.speech_expand_rate},
+ {StatsReport::kStatsValueNameAccelerateRate, info.accelerate_rate},
+ {StatsReport::kStatsValueNamePreemptiveExpandRate,
+ info.preemptive_expand_rate},
+ {StatsReport::kStatsValueNameTotalAudioEnergy, info.total_output_energy},
+ {StatsReport::kStatsValueNameTotalSamplesDuration,
+ info.total_output_duration}};
const IntForAdd ints[] = {
- { StatsReport::kStatsValueNameCurrentDelayMs, info.delay_estimate_ms },
- { StatsReport::kStatsValueNameDecodingCNG, info.decoding_cng },
- { StatsReport::kStatsValueNameDecodingCTN, info.decoding_calls_to_neteq },
- { StatsReport::kStatsValueNameDecodingCTSG,
- info.decoding_calls_to_silence_generator },
- { StatsReport::kStatsValueNameDecodingMutedOutput,
- info.decoding_muted_output },
- { StatsReport::kStatsValueNameDecodingNormal, info.decoding_normal },
- { StatsReport::kStatsValueNameDecodingPLC, info.decoding_plc },
- { StatsReport::kStatsValueNameDecodingPLCCNG, info.decoding_plc_cng },
- { StatsReport::kStatsValueNameJitterBufferMs, info.jitter_buffer_ms },
- { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms },
- { StatsReport::kStatsValueNamePacketsLost, info.packets_lost },
- { StatsReport::kStatsValueNamePacketsReceived, info.packets_rcvd },
- { StatsReport::kStatsValueNamePreferredJitterBufferMs,
- info.jitter_buffer_preferred_ms },
+ {StatsReport::kStatsValueNameCurrentDelayMs, info.delay_estimate_ms},
+ {StatsReport::kStatsValueNameDecodingCNG, info.decoding_cng},
+ {StatsReport::kStatsValueNameDecodingCTN, info.decoding_calls_to_neteq},
+ {StatsReport::kStatsValueNameDecodingCTSG,
+ info.decoding_calls_to_silence_generator},
+ {StatsReport::kStatsValueNameDecodingMutedOutput,
+ info.decoding_muted_output},
+ {StatsReport::kStatsValueNameDecodingNormal, info.decoding_normal},
+ {StatsReport::kStatsValueNameDecodingPLC, info.decoding_plc},
+ {StatsReport::kStatsValueNameDecodingPLCCNG, info.decoding_plc_cng},
+ {StatsReport::kStatsValueNameJitterBufferMs, info.jitter_buffer_ms},
+ {StatsReport::kStatsValueNameJitterReceived, info.jitter_ms},
+ {StatsReport::kStatsValueNamePacketsLost, info.packets_lost},
+ {StatsReport::kStatsValueNamePacketsReceived, info.packets_rcvd},
+ {StatsReport::kStatsValueNamePreferredJitterBufferMs,
+ info.jitter_buffer_preferred_ms},
};
for (const auto& f : floats)
@@ -176,8 +175,7 @@
info.audio_level);
}
- report->AddInt64(StatsReport::kStatsValueNameBytesReceived,
- info.bytes_rcvd);
+ report->AddInt64(StatsReport::kStatsValueNameBytesReceived, info.bytes_rcvd);
if (info.capture_start_ntp_time_ms >= 0) {
report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs,
info.capture_start_ntp_time_ms);
@@ -192,17 +190,16 @@
info.apm_statistics);
const FloatForAdd floats[] = {
- { StatsReport::kStatsValueNameTotalAudioEnergy, info.total_input_energy },
- { StatsReport::kStatsValueNameTotalSamplesDuration,
- info.total_input_duration }
- };
+ {StatsReport::kStatsValueNameTotalAudioEnergy, info.total_input_energy},
+ {StatsReport::kStatsValueNameTotalSamplesDuration,
+ info.total_input_duration}};
RTC_DCHECK_GE(info.audio_level, 0);
const IntForAdd ints[] = {
- { StatsReport::kStatsValueNameAudioInputLevel, info.audio_level},
- { StatsReport::kStatsValueNameJitterReceived, info.jitter_ms },
- { StatsReport::kStatsValueNamePacketsLost, info.packets_lost },
- { StatsReport::kStatsValueNamePacketsSent, info.packets_sent },
+ {StatsReport::kStatsValueNameAudioInputLevel, info.audio_level},
+ {StatsReport::kStatsValueNameJitterReceived, info.jitter_ms},
+ {StatsReport::kStatsValueNamePacketsLost, info.packets_lost},
+ {StatsReport::kStatsValueNamePacketsSent, info.packets_sent},
};
for (const auto& f : floats) {
@@ -249,8 +246,7 @@
ExtractCommonReceiveProperties(info, report);
report->AddString(StatsReport::kStatsValueNameCodecImplementationName,
info.decoder_implementation_name);
- report->AddInt64(StatsReport::kStatsValueNameBytesReceived,
- info.bytes_rcvd);
+ report->AddInt64(StatsReport::kStatsValueNameBytesReceived, info.bytes_rcvd);
if (info.capture_start_ntp_time_ms >= 0) {
report->AddInt64(StatsReport::kStatsValueNameCaptureStartNtpTimeMs,
info.capture_start_ntp_time_ms);
@@ -259,25 +255,25 @@
report->AddInt64(StatsReport::kStatsValueNameQpSum, *info.qp_sum);
const IntForAdd ints[] = {
- { StatsReport::kStatsValueNameCurrentDelayMs, info.current_delay_ms },
- { StatsReport::kStatsValueNameDecodeMs, info.decode_ms },
- { StatsReport::kStatsValueNameFirsSent, info.firs_sent },
- { StatsReport::kStatsValueNameFrameHeightReceived, info.frame_height },
- { StatsReport::kStatsValueNameFrameRateDecoded, info.framerate_decoded },
- { StatsReport::kStatsValueNameFrameRateOutput, info.framerate_output },
- { StatsReport::kStatsValueNameFrameRateReceived, info.framerate_rcvd },
- { StatsReport::kStatsValueNameFrameWidthReceived, info.frame_width },
- { StatsReport::kStatsValueNameJitterBufferMs, info.jitter_buffer_ms },
- { StatsReport::kStatsValueNameMaxDecodeMs, info.max_decode_ms },
- { StatsReport::kStatsValueNameMinPlayoutDelayMs,
- info.min_playout_delay_ms },
- { StatsReport::kStatsValueNameNacksSent, info.nacks_sent },
- { StatsReport::kStatsValueNamePacketsLost, info.packets_lost },
- { StatsReport::kStatsValueNamePacketsReceived, info.packets_rcvd },
- { StatsReport::kStatsValueNamePlisSent, info.plis_sent },
- { StatsReport::kStatsValueNameRenderDelayMs, info.render_delay_ms },
- { StatsReport::kStatsValueNameTargetDelayMs, info.target_delay_ms },
- { StatsReport::kStatsValueNameFramesDecoded, info.frames_decoded },
+ {StatsReport::kStatsValueNameCurrentDelayMs, info.current_delay_ms},
+ {StatsReport::kStatsValueNameDecodeMs, info.decode_ms},
+ {StatsReport::kStatsValueNameFirsSent, info.firs_sent},
+ {StatsReport::kStatsValueNameFrameHeightReceived, info.frame_height},
+ {StatsReport::kStatsValueNameFrameRateDecoded, info.framerate_decoded},
+ {StatsReport::kStatsValueNameFrameRateOutput, info.framerate_output},
+ {StatsReport::kStatsValueNameFrameRateReceived, info.framerate_rcvd},
+ {StatsReport::kStatsValueNameFrameWidthReceived, info.frame_width},
+ {StatsReport::kStatsValueNameJitterBufferMs, info.jitter_buffer_ms},
+ {StatsReport::kStatsValueNameMaxDecodeMs, info.max_decode_ms},
+ {StatsReport::kStatsValueNameMinPlayoutDelayMs,
+ info.min_playout_delay_ms},
+ {StatsReport::kStatsValueNameNacksSent, info.nacks_sent},
+ {StatsReport::kStatsValueNamePacketsLost, info.packets_lost},
+ {StatsReport::kStatsValueNamePacketsReceived, info.packets_rcvd},
+ {StatsReport::kStatsValueNamePlisSent, info.plis_sent},
+ {StatsReport::kStatsValueNameRenderDelayMs, info.render_delay_ms},
+ {StatsReport::kStatsValueNameTargetDelayMs, info.target_delay_ms},
+ {StatsReport::kStatsValueNameFramesDecoded, info.frames_decoded},
};
for (const auto& i : ints)
@@ -345,14 +341,14 @@
report->set_timestamp(stats_gathering_started);
const IntForAdd ints[] = {
- { StatsReport::kStatsValueNameAvailableSendBandwidth,
- info.available_send_bandwidth },
- { StatsReport::kStatsValueNameAvailableReceiveBandwidth,
- info.available_recv_bandwidth },
- { StatsReport::kStatsValueNameTargetEncBitrate, info.target_enc_bitrate },
- { StatsReport::kStatsValueNameActualEncBitrate, info.actual_enc_bitrate },
- { StatsReport::kStatsValueNameRetransmitBitrate, info.retransmit_bitrate },
- { StatsReport::kStatsValueNameTransmitBitrate, info.transmit_bitrate },
+ {StatsReport::kStatsValueNameAvailableSendBandwidth,
+ info.available_send_bandwidth},
+ {StatsReport::kStatsValueNameAvailableReceiveBandwidth,
+ info.available_recv_bandwidth},
+ {StatsReport::kStatsValueNameTargetEncBitrate, info.target_enc_bitrate},
+ {StatsReport::kStatsValueNameActualEncBitrate, info.actual_enc_bitrate},
+ {StatsReport::kStatsValueNameRetransmitBitrate, info.retransmit_bitrate},
+ {StatsReport::kStatsValueNameTransmitBitrate, info.transmit_bitrate},
};
for (const auto& i : ints)
report->AddInt(i.name, i.value);
@@ -375,7 +371,7 @@
// In order to use the template, the functions that are called from it,
// ExtractStats and ExtractRemoteStats, must be defined and overloaded
// for each type.
-template<typename T>
+template <typename T>
void ExtractStatsFromList(const std::vector<T>& data,
const StatsReport::Id& transport_id,
StatsCollector* collector,
@@ -384,8 +380,8 @@
uint32_t ssrc = d.ssrc();
// Each track can have stats for both local and remote objects.
// TODO(hta): Handle the case of multiple SSRCs per object.
- StatsReport* report = collector->PrepareReport(true, ssrc, transport_id,
- direction);
+ StatsReport* report =
+ collector->PrepareReport(true, ssrc, transport_id, direction);
if (report)
ExtractStats(d, report);
@@ -529,8 +525,8 @@
if (report)
reports->push_back(report);
- report = reports_.Find(StatsReport::NewTypedId(
- StatsReport::kStatsReportTypeTrack, track->id()));
+ report = reports_.Find(
+ StatsReport::NewTypedId(StatsReport::kStatsReportTypeTrack, track->id()));
if (!report)
return;
@@ -549,8 +545,8 @@
}
}
-void
-StatsCollector::UpdateStats(PeerConnectionInterface::StatsOutputLevel level) {
+void StatsCollector::UpdateStats(
+ PeerConnectionInterface::StatsOutputLevel level) {
RTC_DCHECK(pc_->signaling_thread()->IsCurrent());
double time_now = GetTimeNow();
// Calls to UpdateStats() that occur less than kMinGatherStatsPeriod number of
@@ -576,11 +572,10 @@
UpdateTrackReports();
}
-StatsReport* StatsCollector::PrepareReport(
- bool local,
- uint32_t ssrc,
- const StatsReport::Id& transport_id,
- StatsReport::Direction direction) {
+StatsReport* StatsCollector::PrepareReport(bool local,
+ uint32_t ssrc,
+ const StatsReport::Id& transport_id,
+ StatsReport::Direction direction) {
RTC_DCHECK(pc_->signaling_thread()->IsCurrent());
StatsReport::Id id(StatsReport::NewIdWithDirection(
local ? StatsReport::kStatsReportTypeSsrc
@@ -652,18 +647,20 @@
}
StatsReport* StatsCollector::AddConnectionInfoReport(
- const std::string& content_name, int component, int connection_id,
+ const std::string& content_name,
+ int component,
+ int connection_id,
const StatsReport::Id& channel_report_id,
const cricket::ConnectionInfo& info) {
- StatsReport::Id id(StatsReport::NewCandidatePairId(content_name, component,
- connection_id));
+ StatsReport::Id id(
+ StatsReport::NewCandidatePairId(content_name, component, connection_id));
StatsReport* report = reports_.ReplaceOrAddNew(id);
report->set_timestamp(stats_gathering_started_);
const BoolForAdd bools[] = {
- {StatsReport::kStatsValueNameActiveConnection, info.best_connection},
- {StatsReport::kStatsValueNameReceiving, info.receiving},
- {StatsReport::kStatsValueNameWritable, info.writable},
+ {StatsReport::kStatsValueNameActiveConnection, info.best_connection},
+ {StatsReport::kStatsValueNameReceiving, info.receiving},
+ {StatsReport::kStatsValueNameWritable, info.writable},
};
for (const auto& b : bools)
report->AddBoolean(b.name, b.value);
@@ -842,7 +839,7 @@
int connection_id = 0;
for (const cricket::ConnectionInfo& info :
- channel_iter.connection_infos) {
+ channel_iter.connection_infos) {
StatsReport* connection_report = AddConnectionInfoReport(
transport_name, channel_iter.component, connection_id++,
channel_report->id(), info);