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:
@ -64,8 +64,7 @@ RtpRtcp* RtpRtcp::CreateRtpRtcp(const RtpRtcp::Configuration& configuration) {
|
||||
} else {
|
||||
// No clock implementation provided, use default clock.
|
||||
RtpRtcp::Configuration configuration_copy;
|
||||
memcpy(&configuration_copy, &configuration,
|
||||
sizeof(RtpRtcp::Configuration));
|
||||
memcpy(&configuration_copy, &configuration, sizeof(RtpRtcp::Configuration));
|
||||
configuration_copy.clock = Clock::GetRealTimeClock();
|
||||
return new ModuleRtpRtcpImpl(configuration_copy);
|
||||
}
|
||||
@ -221,10 +220,10 @@ void ModuleRtpRtcpImpl::Process() {
|
||||
} else {
|
||||
// Report rtt from receiver.
|
||||
if (process_rtt) {
|
||||
int64_t rtt_ms;
|
||||
if (rtt_stats_ && rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms)) {
|
||||
rtt_stats_->OnRttUpdate(rtt_ms);
|
||||
}
|
||||
int64_t rtt_ms;
|
||||
if (rtt_stats_ && rtcp_receiver_.GetAndResetXrRrRtt(&rtt_ms)) {
|
||||
rtt_stats_->OnRttUpdate(rtt_ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,8 +276,7 @@ void ModuleRtpRtcpImpl::IncomingRtcpPacket(const uint8_t* rtcp_packet,
|
||||
rtcp_receiver_.IncomingPacket(rtcp_packet, length);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::RegisterSendPayload(
|
||||
const CodecInst& voice_codec) {
|
||||
int32_t ModuleRtpRtcpImpl::RegisterSendPayload(const CodecInst& voice_codec) {
|
||||
return rtp_sender_->RegisterPayload(
|
||||
voice_codec.plname, voice_codec.pltype, voice_codec.plfreq,
|
||||
voice_codec.channels, (voice_codec.rate < 0) ? 0 : voice_codec.rate);
|
||||
@ -365,16 +363,15 @@ RTCPSender::FeedbackState ModuleRtpRtcpImpl::GetFeedbackState() {
|
||||
StreamDataCounters rtp_stats;
|
||||
StreamDataCounters rtx_stats;
|
||||
rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats);
|
||||
state.packets_sent = rtp_stats.transmitted.packets +
|
||||
rtx_stats.transmitted.packets;
|
||||
state.packets_sent =
|
||||
rtp_stats.transmitted.packets + rtx_stats.transmitted.packets;
|
||||
state.media_bytes_sent = rtp_stats.transmitted.payload_bytes +
|
||||
rtx_stats.transmitted.payload_bytes;
|
||||
state.send_bitrate = rtp_sender_->BitrateSent();
|
||||
}
|
||||
state.module = this;
|
||||
|
||||
LastReceivedNTP(&state.last_rr_ntp_secs,
|
||||
&state.last_rr_ntp_frac,
|
||||
LastReceivedNTP(&state.last_rr_ntp_secs, &state.last_rr_ntp_frac,
|
||||
&state.remote_sr);
|
||||
|
||||
state.last_xr_rtis = rtcp_receiver_.ConsumeReceivedXrReferenceTimeInfo();
|
||||
@ -432,7 +429,7 @@ bool ModuleRtpRtcpImpl::SendOutgoingData(
|
||||
rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms);
|
||||
// Make sure an RTCP report isn't queued behind a key frame.
|
||||
if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) {
|
||||
rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport);
|
||||
rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport);
|
||||
}
|
||||
int64_t expected_retransmission_time_ms = rtt_ms();
|
||||
if (expected_retransmission_time_ms == 0) {
|
||||
@ -456,7 +453,7 @@ bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc,
|
||||
bool retransmission,
|
||||
const PacedPacketInfo& pacing_info) {
|
||||
return rtp_sender_->TimeToSendPacket(ssrc, sequence_number, capture_time_ms,
|
||||
retransmission, pacing_info);
|
||||
retransmission, pacing_info);
|
||||
}
|
||||
|
||||
size_t ModuleRtpRtcpImpl::TimeToSendPadding(
|
||||
@ -501,22 +498,18 @@ int32_t ModuleRtpRtcpImpl::RemoveMixedCNAME(const uint32_t ssrc) {
|
||||
return rtcp_sender_.RemoveMixedCNAME(ssrc);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::RemoteCNAME(
|
||||
const uint32_t remote_ssrc,
|
||||
char c_name[RTCP_CNAME_SIZE]) const {
|
||||
int32_t ModuleRtpRtcpImpl::RemoteCNAME(const uint32_t remote_ssrc,
|
||||
char c_name[RTCP_CNAME_SIZE]) const {
|
||||
return rtcp_receiver_.CNAME(remote_ssrc, c_name);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::RemoteNTP(
|
||||
uint32_t* received_ntpsecs,
|
||||
uint32_t* received_ntpfrac,
|
||||
uint32_t* rtcp_arrival_time_secs,
|
||||
uint32_t* rtcp_arrival_time_frac,
|
||||
uint32_t* rtcp_timestamp) const {
|
||||
return rtcp_receiver_.NTP(received_ntpsecs,
|
||||
received_ntpfrac,
|
||||
rtcp_arrival_time_secs,
|
||||
rtcp_arrival_time_frac,
|
||||
int32_t ModuleRtpRtcpImpl::RemoteNTP(uint32_t* received_ntpsecs,
|
||||
uint32_t* received_ntpfrac,
|
||||
uint32_t* rtcp_arrival_time_secs,
|
||||
uint32_t* rtcp_arrival_time_frac,
|
||||
uint32_t* rtcp_timestamp) const {
|
||||
return rtcp_receiver_.NTP(received_ntpsecs, received_ntpfrac,
|
||||
rtcp_arrival_time_secs, rtcp_arrival_time_frac,
|
||||
rtcp_timestamp)
|
||||
? 0
|
||||
: -1;
|
||||
@ -554,13 +547,13 @@ int32_t ModuleRtpRtcpImpl::SetRTCPApplicationSpecificData(
|
||||
const uint32_t name,
|
||||
const uint8_t* data,
|
||||
const uint16_t length) {
|
||||
return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
|
||||
return rtcp_sender_.SetApplicationSpecificData(sub_type, name, data, length);
|
||||
}
|
||||
|
||||
// (XR) VOIP metric.
|
||||
int32_t ModuleRtpRtcpImpl::SetRTCPVoIPMetrics(
|
||||
const RTCPVoIPMetric* voip_metric) {
|
||||
return rtcp_sender_.SetRTCPVoIPMetrics(voip_metric);
|
||||
const RTCPVoIPMetric* voip_metric) {
|
||||
return rtcp_sender_.SetRTCPVoIPMetrics(voip_metric);
|
||||
}
|
||||
|
||||
void ModuleRtpRtcpImpl::SetRtcpXrRrtrStatus(bool enable) {
|
||||
@ -573,9 +566,8 @@ bool ModuleRtpRtcpImpl::RtcpXrRrtrStatus() const {
|
||||
}
|
||||
|
||||
// TODO(asapersson): Replace this method with the one below.
|
||||
int32_t ModuleRtpRtcpImpl::DataCountersRTP(
|
||||
size_t* bytes_sent,
|
||||
uint32_t* packets_sent) const {
|
||||
int32_t ModuleRtpRtcpImpl::DataCountersRTP(size_t* bytes_sent,
|
||||
uint32_t* packets_sent) const {
|
||||
StreamDataCounters rtp_stats;
|
||||
StreamDataCounters rtx_stats;
|
||||
rtp_sender_->GetDataCounters(&rtp_stats, &rtx_stats);
|
||||
@ -589,8 +581,8 @@ int32_t ModuleRtpRtcpImpl::DataCountersRTP(
|
||||
rtx_stats.transmitted.header_bytes;
|
||||
}
|
||||
if (packets_sent) {
|
||||
*packets_sent = rtp_stats.transmitted.packets +
|
||||
rtx_stats.transmitted.packets;
|
||||
*packets_sent =
|
||||
rtp_stats.transmitted.packets + rtx_stats.transmitted.packets;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -605,7 +597,8 @@ void ModuleRtpRtcpImpl::GetRtpPacketLossStats(
|
||||
bool outgoing,
|
||||
uint32_t ssrc,
|
||||
struct RtpPacketLossStats* loss_stats) const {
|
||||
if (!loss_stats) return;
|
||||
if (!loss_stats)
|
||||
return;
|
||||
const PacketLossStats* stats_source = NULL;
|
||||
if (outgoing) {
|
||||
if (SSRC() == ssrc) {
|
||||
@ -617,8 +610,7 @@ void ModuleRtpRtcpImpl::GetRtpPacketLossStats(
|
||||
}
|
||||
}
|
||||
if (stats_source) {
|
||||
loss_stats->single_packet_loss_count =
|
||||
stats_source->GetSingleLossCount();
|
||||
loss_stats->single_packet_loss_count = stats_source->GetSingleLossCount();
|
||||
loss_stats->multiple_packet_loss_event_count =
|
||||
stats_source->GetMultipleLossEventCount();
|
||||
loss_stats->multiple_packet_loss_packet_count =
|
||||
@ -776,15 +768,13 @@ bool ModuleRtpRtcpImpl::SendFeedbackPacket(
|
||||
}
|
||||
|
||||
// Send a TelephoneEvent tone using RFC 2833 (4733).
|
||||
int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband(
|
||||
const uint8_t key,
|
||||
const uint16_t time_ms,
|
||||
const uint8_t level) {
|
||||
int32_t ModuleRtpRtcpImpl::SendTelephoneEventOutband(const uint8_t key,
|
||||
const uint16_t time_ms,
|
||||
const uint8_t level) {
|
||||
return rtp_sender_->SendTelephoneEvent(key, time_ms, level);
|
||||
}
|
||||
|
||||
int32_t ModuleRtpRtcpImpl::SetAudioLevel(
|
||||
const uint8_t level_d_bov) {
|
||||
int32_t ModuleRtpRtcpImpl::SetAudioLevel(const uint8_t level_d_bov) {
|
||||
return rtp_sender_->SetAudioLevel(level_d_bov);
|
||||
}
|
||||
|
||||
@ -843,8 +833,7 @@ void ModuleRtpRtcpImpl::OnReceivedNack(
|
||||
for (uint16_t nack_sequence_number : nack_sequence_numbers) {
|
||||
send_loss_stats_.AddLostPacket(nack_sequence_number);
|
||||
}
|
||||
if (!rtp_sender_->StorePackets() ||
|
||||
nack_sequence_numbers.size() == 0) {
|
||||
if (!rtp_sender_->StorePackets() || nack_sequence_numbers.size() == 0) {
|
||||
return;
|
||||
}
|
||||
// Use RTT from RtcpRttStats class if provided.
|
||||
@ -869,11 +858,8 @@ bool ModuleRtpRtcpImpl::LastReceivedNTP(
|
||||
uint32_t ntp_secs = 0;
|
||||
uint32_t ntp_frac = 0;
|
||||
|
||||
if (!rtcp_receiver_.NTP(&ntp_secs,
|
||||
&ntp_frac,
|
||||
rtcp_arrival_time_secs,
|
||||
rtcp_arrival_time_frac,
|
||||
NULL)) {
|
||||
if (!rtcp_receiver_.NTP(&ntp_secs, &ntp_frac, rtcp_arrival_time_secs,
|
||||
rtcp_arrival_time_frac, NULL)) {
|
||||
return false;
|
||||
}
|
||||
*remote_sr =
|
||||
@ -922,7 +908,7 @@ void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
|
||||
}
|
||||
|
||||
StreamDataCountersCallback*
|
||||
ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
|
||||
ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
|
||||
return rtp_sender_->GetRtpStatisticsCallback();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user