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:
Yves Gerey
2018-06-19 15:03:05 +02:00
parent b602123a5a
commit 665174fdbb
1569 changed files with 30495 additions and 30309 deletions

View File

@ -28,9 +28,7 @@ namespace cricket {
// We want to avoid IP fragmentation.
static const size_t kDataMaxRtpPacketLen = 1200U;
// We reserve space after the RTP header for future wiggle room.
static const unsigned char kReservedSpace[] = {
0x00, 0x00, 0x00, 0x00
};
static const unsigned char kReservedSpace[] = {0x00, 0x00, 0x00, 0x00};
// Amount of overhead SRTP may take. We need to leave room in the
// buffer for it, otherwise SRTP will fail later. If SRTP ever uses
@ -42,8 +40,7 @@ RtpDataEngine::RtpDataEngine() {
DataCodec(kGoogleRtpDataCodecPlType, kGoogleRtpDataCodecName));
}
DataMediaChannel* RtpDataEngine::CreateChannel(
const MediaConfig& config) {
DataMediaChannel* RtpDataEngine::CreateChannel(const MediaConfig& config) {
return new RtpDataMediaChannel(config);
}
@ -67,18 +64,16 @@ void RtpDataMediaChannel::Construct() {
send_limiter_.reset(new rtc::DataRateLimiter(kDataMaxBandwidth / 8, 1.0));
}
RtpDataMediaChannel::~RtpDataMediaChannel() {
std::map<uint32_t, RtpClock*>::const_iterator iter;
for (iter = rtp_clock_by_send_ssrc_.begin();
iter != rtp_clock_by_send_ssrc_.end();
++iter) {
iter != rtp_clock_by_send_ssrc_.end(); ++iter) {
delete iter->second;
}
}
void RTC_NO_SANITIZE("float-cast-overflow") // bugs.webrtc.org/8204
RtpClock::Tick(double now, int* seq_num, uint32_t* timestamp) {
RtpClock::Tick(double now, int* seq_num, uint32_t* timestamp) {
*seq_num = ++last_seq_num_;
*timestamp = timestamp_offset_ + static_cast<uint32_t>(now * clockrate_);
// UBSan: 5.92374e+10 is outside the range of representable values of type
@ -155,9 +150,9 @@ bool RtpDataMediaChannel::AddSendStream(const StreamParams& stream) {
send_streams_.push_back(stream);
// TODO(pthatcher): This should be per-stream, not per-ssrc.
// And we should probably allow more than one per stream.
rtp_clock_by_send_ssrc_[stream.first_ssrc()] = new RtpClock(
kDataCodecClockrate,
rtc::CreateRandomNonZeroId(), rtc::CreateRandomNonZeroId());
rtp_clock_by_send_ssrc_[stream.first_ssrc()] =
new RtpClock(kDataCodecClockrate, rtc::CreateRandomNonZeroId(),
rtc::CreateRandomNonZeroId());
RTC_LOG(LS_INFO) << "Added data send stream '" << stream.id
<< "' with ssrc=" << stream.first_ssrc();
@ -198,8 +193,8 @@ bool RtpDataMediaChannel::RemoveRecvStream(uint32_t ssrc) {
return true;
}
void RtpDataMediaChannel::OnPacketReceived(
rtc::CopyOnWriteBuffer* packet, const rtc::PacketTime& packet_time) {
void RtpDataMediaChannel::OnPacketReceived(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketTime& packet_time) {
RtpHeader header;
if (!GetRtpHeader(packet->cdata(), packet->size(), &header)) {
return;
@ -254,10 +249,9 @@ bool RtpDataMediaChannel::SetMaxSendBandwidth(int bps) {
return true;
}
bool RtpDataMediaChannel::SendData(
const SendDataParams& params,
const rtc::CopyOnWriteBuffer& payload,
SendDataResult* result) {
bool RtpDataMediaChannel::SendData(const SendDataParams& params,
const rtc::CopyOnWriteBuffer& payload,
SendDataResult* result) {
if (result) {
// If we return true, we'll set this to SDR_SUCCESS.
*result = SDR_ERROR;
@ -310,8 +304,8 @@ bool RtpDataMediaChannel::SendData(
RtpHeader header;
header.payload_type = found_codec->id;
header.ssrc = params.ssrc;
rtp_clock_by_send_ssrc_[header.ssrc]->Tick(
now, &header.seq_num, &header.timestamp);
rtp_clock_by_send_ssrc_[header.ssrc]->Tick(now, &header.seq_num,
&header.timestamp);
rtc::CopyOnWriteBuffer packet(kMinRtpPacketLen, packet_len);
if (!SetRtpHeader(packet.data(), packet.size(), header)) {