Format ^(api|call|common_audio|examples|media|net|p2p|pc)/

half of the remaining folders

git ls-files | grep -e  "\(\.h\|\.cc\)$" | grep -E "^(api|call|common_audio|examples|media|net|p2p|pc)/" | xargs clang-format -i ; git cl format
after landing: add to .git-blame-ignore-revs

Bug: webrtc:15082
Change-Id: I8b2cac13f4587d3ce9b2fccc7362967283f57ea2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/302062
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39977}
This commit is contained in:
Jared Siskin 2023-04-20 14:10:51 -07:00 committed by WebRTC LUCI CQ
parent 32b64e895c
commit bceec84aee
36 changed files with 112 additions and 95 deletions

View file

@ -10,7 +10,6 @@
#include "api/audio_codecs/audio_decoder.h"
#include <memory>
#include <utility>

View file

@ -32,8 +32,9 @@ AudioEncoderMultiChannelOpusConfig::AudioEncoderMultiChannelOpusConfig(
const AudioEncoderMultiChannelOpusConfig&) = default;
AudioEncoderMultiChannelOpusConfig::~AudioEncoderMultiChannelOpusConfig() =
default;
AudioEncoderMultiChannelOpusConfig& AudioEncoderMultiChannelOpusConfig::
operator=(const AudioEncoderMultiChannelOpusConfig&) = default;
AudioEncoderMultiChannelOpusConfig&
AudioEncoderMultiChannelOpusConfig::operator=(
const AudioEncoderMultiChannelOpusConfig&) = default;
bool AudioEncoderMultiChannelOpusConfig::IsOk() const {
if (frame_size_ms <= 0 || frame_size_ms % 10 != 0)

View file

@ -9,6 +9,7 @@
*/
#include "api/media_stream_interface.h"
#include "api/media_types.h"
namespace webrtc {

View file

@ -9,6 +9,7 @@
*/
#include "api/neteq/default_neteq_controller_factory.h"
#include "modules/audio_coding/neteq/decision_logic.h"
namespace webrtc {

View file

@ -13,7 +13,6 @@
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>

View file

@ -163,7 +163,9 @@ class RTC_EXPORT RTCStats {
return std::make_unique<this_class>(*this); \
} \
\
const char* this_class::type() const { return this_class::kType; } \
const char* this_class::type() const { \
return this_class::kType; \
} \
\
std::vector<const webrtc::RTCStatsMemberInterface*> \
this_class::MembersOfThisObjectAndAncestors( \
@ -194,7 +196,9 @@ class RTC_EXPORT RTCStats {
return std::make_unique<this_class>(*this); \
} \
\
const char* this_class::type() const { return this_class::kType; } \
const char* this_class::type() const { \
return this_class::kType; \
} \
\
std::vector<const webrtc::RTCStatsMemberInterface*> \
this_class::MembersOfThisObjectAndAncestors( \

View file

@ -8,9 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/units/timestamp.h"
#include <limits>
#include "api/units/timestamp.h"
#include "test/gtest.h"
namespace webrtc {

View file

@ -11,6 +11,7 @@
#include "api/video_codecs/video_encoder.h"
#include <string.h>
#include <algorithm>
#include "rtc_base/checks.h"

View file

@ -8,10 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/voip/voip_engine_factory.h"
#include <utility>
#include "api/task_queue/default_task_queue_factory.h"
#include "api/voip/voip_engine_factory.h"
#include "modules/audio_device/include/mock_audio_device.h"
#include "modules/audio_processing/include/mock_audio_processing.h"
#include "test/gtest.h"

View file

@ -12,7 +12,6 @@
#define CALL_ADAPTATION_TEST_MOCK_RESOURCE_LISTENER_H_
#include "api/adaptation/resource.h"
#include "test/gmock.h"
namespace webrtc {

View file

@ -93,9 +93,7 @@ class FlexfecReceiveStreamTest : public ::testing::Test {
receive_stream_->RegisterWithTransport(&rtp_stream_receiver_controller_);
}
~FlexfecReceiveStreamTest() {
receive_stream_->UnregisterFromTransport();
}
~FlexfecReceiveStreamTest() { receive_stream_->UnregisterFromTransport(); }
rtc::AutoThread main_thread_;
MockTransport rtcp_send_transport_;

View file

@ -711,7 +711,6 @@ TEST_F(RtpDemuxerTest, AssociatingByRsidAndBySsrcCannotTriggerDoubleCall) {
EXPECT_TRUE(demuxer_.OnRtpPacket(*packet));
}
// If one sink is associated with SSRC x, and another sink with RSID y, then if
// we receive a packet with both SSRC x and RSID y, route that to only the sink
// for RSID y since we believe RSID tags to be more trustworthy than signaled

View file

@ -923,14 +923,14 @@ int RtpVideoSender::ProtectionRequest(const FecProtectionParams* delta_params,
*sent_nack_rate_bps = 0;
*sent_fec_rate_bps = 0;
for (const RtpStreamSender& stream : rtp_streams_) {
stream.rtp_rtcp->SetFecProtectionParams(*delta_params, *key_params);
stream.rtp_rtcp->SetFecProtectionParams(*delta_params, *key_params);
auto send_bitrate = stream.rtp_rtcp->GetSendRates();
*sent_video_rate_bps += send_bitrate[RtpPacketMediaType::kVideo].bps();
*sent_fec_rate_bps +=
send_bitrate[RtpPacketMediaType::kForwardErrorCorrection].bps();
*sent_nack_rate_bps +=
send_bitrate[RtpPacketMediaType::kRetransmission].bps();
auto send_bitrate = stream.rtp_rtcp->GetSendRates();
*sent_video_rate_bps += send_bitrate[RtpPacketMediaType::kVideo].bps();
*sent_fec_rate_bps +=
send_bitrate[RtpPacketMediaType::kForwardErrorCorrection].bps();
*sent_nack_rate_bps +=
send_bitrate[RtpPacketMediaType::kRetransmission].bps();
}
return 0;
}

View file

@ -157,10 +157,10 @@ class SincResampler {
// Data from the source is copied into this buffer for each processing pass.
std::unique_ptr<float[], AlignedFreeDeleter> input_buffer_;
// Stores the runtime selection of which Convolve function to use.
// TODO(ajm): Move to using a global static which must only be initialized
// once by the user. We're not doing this initially, because we don't have
// e.g. a LazyInstance helper in webrtc.
// Stores the runtime selection of which Convolve function to use.
// TODO(ajm): Move to using a global static which must only be initialized
// once by the user. We're not doing this initially, because we don't have
// e.g. a LazyInstance helper in webrtc.
typedef float (*ConvolveProc)(const float*,
const float*,
const float*,

View file

@ -286,11 +286,11 @@ Appendix :
w[] and ip[] are compatible with all routines.
*/
#include "common_audio/third_party/ooura/fft_size_256/fft4g.h"
#include <math.h>
#include <stddef.h>
#include "common_audio/third_party/ooura/fft_size_256/fft4g.h"
namespace webrtc {
namespace {

View file

@ -11,6 +11,8 @@
#ifndef COMMON_AUDIO_THIRD_PARTY_OOURA_FFT_SIZE_256_FFT4G_H_
#define COMMON_AUDIO_THIRD_PARTY_OOURA_FFT_SIZE_256_FFT4G_H_
#include <stddef.h>
namespace webrtc {
// Refer to fft4g.c for documentation.

View file

@ -13,6 +13,7 @@
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include "rtc_base/checks.h"

View file

@ -10,9 +10,8 @@
#include "examples/androidnativeapi/jni/android_call_client.h"
#include <utility>
#include <memory>
#include <utility>
#include "api/peer_connection_interface.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"

View file

@ -12,6 +12,7 @@
#include <errno.h>
#include <sys/socket.h>
#include <algorithm>
#include <map>
#include <memory>

View file

@ -303,8 +303,7 @@ inline bool RemoveStreamBySsrc(StreamParamsVec* streams, uint32_t ssrc) {
return RemoveStream(
streams, [&ssrc](const StreamParams& sp) { return sp.has_ssrc(ssrc); });
}
inline bool RemoveStreamByIds(StreamParamsVec* streams,
const std::string& id) {
inline bool RemoveStreamByIds(StreamParamsVec* streams, const std::string& id) {
return RemoveStream(streams,
[&id](const StreamParams& sp) { return sp.id == id; });
}

View file

@ -40,8 +40,8 @@ struct Fraction {
// Determines number of output pixels if both width and height of an input of
// `input_pixels` pixels is scaled with the fraction numerator / denominator.
int scale_pixel_count(int input_pixels) {
return (numerator * numerator * static_cast<int64_t>(input_pixels))
/ (denominator * denominator);
return (numerator * numerator * static_cast<int64_t>(input_pixels)) /
(denominator * denominator);
}
};

View file

@ -202,8 +202,7 @@ int FakeWebRtcVideoEncoder::GetNumEncodedFrames() {
// Video encoder factory.
FakeWebRtcVideoEncoderFactory::FakeWebRtcVideoEncoderFactory()
: num_created_encoders_(0),
vp8_factory_mode_(false) {}
: num_created_encoders_(0), vp8_factory_mode_(false) {}
std::vector<webrtc::SdpVideoFormat>
FakeWebRtcVideoEncoderFactory::GetSupportedFormats() const {

View file

@ -89,10 +89,10 @@ std::string DataChunk::ToString() const {
rtc::StringBuilder sb;
sb << "DATA, type=" << (options().is_unordered ? "unordered" : "ordered")
<< "::"
<< (*options().is_beginning && *options().is_end
? "complete"
: *options().is_beginning ? "first"
: *options().is_end ? "last" : "middle")
<< (*options().is_beginning && *options().is_end ? "complete"
: *options().is_beginning ? "first"
: *options().is_end ? "last"
: "middle")
<< ", tsn=" << *tsn() << ", sid=" << *stream_id() << ", ssn=" << *ssn()
<< ", ppid=" << *ppid() << ", length=" << payload().size();
return sb.Release();

View file

@ -92,10 +92,10 @@ std::string IDataChunk::ToString() const {
rtc::StringBuilder sb;
sb << "I-DATA, type=" << (options().is_unordered ? "unordered" : "ordered")
<< "::"
<< (*options().is_beginning && *options().is_end
? "complete"
: *options().is_beginning ? "first"
: *options().is_end ? "last" : "middle")
<< (*options().is_beginning && *options().is_end ? "complete"
: *options().is_beginning ? "first"
: *options().is_end ? "last"
: "middle")
<< ", tsn=" << *tsn() << ", stream_id=" << *stream_id()
<< ", message_id=" << *message_id();

View file

@ -25,7 +25,6 @@ rtc::AsyncResolverInterface* BasicAsyncResolverFactory::Create() {
return new rtc::AsyncResolver();
}
std::unique_ptr<webrtc::AsyncDnsResolverInterface>
WrappingAsyncDnsResolverFactory::Create() {
return std::make_unique<WrappingAsyncDnsResolver>(wrapped_factory_->Create());

View file

@ -36,16 +36,16 @@ struct ConnectionInfo {
ConnectionInfo(const ConnectionInfo&);
~ConnectionInfo();
bool best_connection; // Is this the best connection we have?
bool writable; // Has this connection received a STUN response?
bool receiving; // Has this connection received anything?
bool timeout; // Has this connection timed out?
size_t rtt; // The STUN RTT for this connection.
bool best_connection; // Is this the best connection we have?
bool writable; // Has this connection received a STUN response?
bool receiving; // Has this connection received anything?
bool timeout; // Has this connection timed out?
size_t rtt; // The STUN RTT for this connection.
size_t sent_discarded_bytes; // Number of outgoing bytes discarded due to
// socket errors.
size_t sent_total_bytes; // Total bytes sent on this connection. Does not
// include discarded bytes.
size_t sent_bytes_second; // Bps over the last measurement interval.
size_t sent_bytes_second; // Bps over the last measurement interval.
size_t sent_discarded_packets; // Number of outgoing packets discarded due to
// socket errors.
size_t sent_total_packets; // Number of total outgoing packets attempted for

View file

@ -35,7 +35,7 @@ const int STUN_INITIAL_RTO = 250; // milliseconds
// The timeout doubles each retransmission, up to this many times
// RFC 5389 says SHOULD retransmit 7 times.
// This has been 8 for years (not sure why).
const int STUN_MAX_RETRANSMISSIONS = 8; // Total sends: 9
const int STUN_MAX_RETRANSMISSIONS = 8; // Total sends: 9
// We also cap the doubling, even though the standard doesn't say to.
// This has been 1.6 seconds for years, but for networks that

View file

@ -9,6 +9,7 @@
*/
#include "p2p/base/transport_description.h"
#include "test/gtest.h"
using webrtc::RTCErrorType;

View file

@ -2380,5 +2380,4 @@ TEST_F(VideoChannelDoubleThreadTest, SocketOptionsMergedOnSetTransport) {
Base::SocketOptionsMergedOnSetTransport();
}
// TODO(pthatcher): TestSetReceiver?

View file

@ -13,6 +13,7 @@
#include <stddef.h>
#include <stdint.h>
#include <deque>
#include <memory>
#include <string>

View file

@ -634,20 +634,18 @@ RTCError PeerConnection::Initialize(
}
// Network thread initialization.
transport_controller_copy_ =
network_thread()->BlockingCall([&] {
RTC_DCHECK_RUN_ON(network_thread());
network_thread_safety_ = PendingTaskSafetyFlag::Create();
InitializePortAllocatorResult pa_result = InitializePortAllocator_n(
stun_servers, turn_servers, configuration);
// Send information about IPv4/IPv6 status.
PeerConnectionAddressFamilyCounter address_family =
pa_result.enable_ipv6 ? kPeerConnection_IPv6 : kPeerConnection_IPv4;
RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.IPMetrics",
address_family,
kPeerConnectionAddressFamilyCounter_Max);
return InitializeTransportController_n(configuration, dependencies);
});
transport_controller_copy_ = network_thread()->BlockingCall([&] {
RTC_DCHECK_RUN_ON(network_thread());
network_thread_safety_ = PendingTaskSafetyFlag::Create();
InitializePortAllocatorResult pa_result =
InitializePortAllocator_n(stun_servers, turn_servers, configuration);
// Send information about IPv4/IPv6 status.
PeerConnectionAddressFamilyCounter address_family =
pa_result.enable_ipv6 ? kPeerConnection_IPv6 : kPeerConnection_IPv4;
RTC_HISTOGRAM_ENUMERATION("WebRTC.PeerConnection.IPMetrics", address_family,
kPeerConnectionAddressFamilyCounter_Max);
return InitializeTransportController_n(configuration, dependencies);
});
configuration_ = configuration;

View file

@ -265,9 +265,7 @@ class PeerConnection : public PeerConnectionInternal,
}
rtc::Thread* worker_thread() const final { return context_->worker_thread(); }
std::string session_id() const override {
return session_id_;
}
std::string session_id() const override { return session_id_; }
bool initial_offerer() const override {
RTC_DCHECK_RUN_ON(signaling_thread());

View file

@ -200,8 +200,12 @@ class ConstMethodCall {
typedef class_name##Interface C; \
\
public: \
const INTERNAL_CLASS* internal() const { return c(); } \
INTERNAL_CLASS* internal() { return c(); }
const INTERNAL_CLASS* internal() const { \
return c(); \
} \
INTERNAL_CLASS* internal() { \
return c(); \
}
// clang-format off
// clang-format would put the semicolon alone,
@ -245,9 +249,15 @@ class ConstMethodCall {
} \
\
private: \
const INTERNAL_CLASS* c() const { return c_.get(); } \
INTERNAL_CLASS* c() { return c_.get(); } \
void DestroyInternal() { c_ = nullptr; } \
const INTERNAL_CLASS* c() const { \
return c_.get(); \
} \
INTERNAL_CLASS* c() { \
return c_.get(); \
} \
void DestroyInternal() { \
c_ = nullptr; \
} \
rtc::scoped_refptr<INTERNAL_CLASS> c_;
// Note: This doesn't use a unique_ptr, because it intends to handle a corner
@ -264,9 +274,15 @@ class ConstMethodCall {
} \
\
private: \
const INTERNAL_CLASS* c() const { return c_; } \
INTERNAL_CLASS* c() { return c_; } \
void DestroyInternal() { delete c_; } \
const INTERNAL_CLASS* c() const { \
return c_; \
} \
INTERNAL_CLASS* c() { \
return c_; \
} \
void DestroyInternal() { \
delete c_; \
} \
INTERNAL_CLASS* c_;
#define BEGIN_PRIMARY_PROXY_MAP(class_name) \
@ -292,16 +308,20 @@ class ConstMethodCall {
primary_thread, secondary_thread, std::move(c)); \
}
#define PROXY_PRIMARY_THREAD_DESTRUCTOR() \
private: \
rtc::Thread* destructor_thread() const { return primary_thread_; } \
\
#define PROXY_PRIMARY_THREAD_DESTRUCTOR() \
private: \
rtc::Thread* destructor_thread() const { \
return primary_thread_; \
} \
\
public: // NOLINTNEXTLINE
#define PROXY_SECONDARY_THREAD_DESTRUCTOR() \
private: \
rtc::Thread* destructor_thread() const { return secondary_thread_; } \
\
#define PROXY_SECONDARY_THREAD_DESTRUCTOR() \
private: \
rtc::Thread* destructor_thread() const { \
return secondary_thread_; \
} \
\
public: // NOLINTNEXTLINE
#if defined(RTC_DISABLE_PROXY_TRACE_EVENTS)

View file

@ -873,8 +873,7 @@ ProduceRemoteInboundRtpStreamStatsFromReportBlockData(
}
remote_inbound->total_round_trip_time =
report_block_data.sum_rtts().seconds<double>();
remote_inbound->round_trip_time_measurements =
report_block_data.num_rtts();
remote_inbound->round_trip_time_measurements = report_block_data.num_rtts();
std::string local_id = RTCOutboundRtpStreamStatsIDFromSSRC(
transport_id, media_type, report_block.source_ssrc);

View file

@ -4764,13 +4764,11 @@ RTCError SdpOfferAnswerHandler::PushdownMediaDescription(
// - crbug.com/1187289
for (const auto& entry : channels) {
std::string error;
bool success =
context_->worker_thread()->BlockingCall([&]() {
return (source == cricket::CS_LOCAL)
? entry.first->SetLocalContent(entry.second, type, error)
: entry.first->SetRemoteContent(entry.second, type,
error);
});
bool success = context_->worker_thread()->BlockingCall([&]() {
return (source == cricket::CS_LOCAL)
? entry.first->SetLocalContent(entry.second, type, error)
: entry.first->SetRemoteContent(entry.second, type, error);
});
if (!success) {
return RTCError(RTCErrorType::INVALID_PARAMETER, error);
}

View file

@ -281,8 +281,7 @@ std::vector<const ContentGroup*> SessionDescription::GetGroupsByName(
return content_groups;
}
ContentInfo::~ContentInfo() {
}
ContentInfo::~ContentInfo() {}
// Copy operator.
ContentInfo::ContentInfo(const ContentInfo& o)