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/test/call_test.cc b/test/call_test.cc
index 789f775..c735e06 100644
--- a/test/call_test.cc
+++ b/test/call_test.cc
@@ -95,7 +95,8 @@
audio_state_config.audio_device_module = fake_recv_audio_device_;
recv_config.audio_state = AudioState::Create(audio_state_config);
fake_recv_audio_device_->RegisterAudioCallback(
- recv_config.audio_state->audio_transport()); }
+ recv_config.audio_state->audio_transport());
+ }
CreateReceiverCall(recv_config);
}
test->OnCallsCreated(sender_call_.get(), receiver_call_.get());
@@ -487,8 +488,7 @@
BaseTest::BaseTest(unsigned int timeout_ms)
: RtpRtcpObserver(timeout_ms), event_log_(RtcEventLog::CreateNull()) {}
-BaseTest::~BaseTest() {
-}
+BaseTest::~BaseTest() {}
std::unique_ptr<TestAudioDeviceModule::Capturer> BaseTest::CreateCapturer() {
return TestAudioDeviceModule::CreatePulsedNoiseCapturer(256, 48000);
@@ -513,8 +513,7 @@
void BaseTest::OnRtpTransportControllerSendCreated(
RtpTransportControllerSend* controller) {}
-void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) {
-}
+void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) {}
test::PacketTransport* BaseTest::CreateSendTransport(
SingleThreadedTaskQueueForTesting* task_queue,
@@ -571,14 +570,11 @@
const std::vector<FlexfecReceiveStream*>& receive_streams) {}
void BaseTest::OnFrameGeneratorCapturerCreated(
- FrameGeneratorCapturer* frame_generator_capturer) {
-}
+ FrameGeneratorCapturer* frame_generator_capturer) {}
-void BaseTest::OnStreamsStopped() {
-}
+void BaseTest::OnStreamsStopped() {}
-SendTest::SendTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
-}
+SendTest::SendTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {}
bool SendTest::ShouldCreateReceivers() const {
return false;
@@ -586,8 +582,7 @@
EndToEndTest::EndToEndTest() {}
-EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {
-}
+EndToEndTest::EndToEndTest(unsigned int timeout_ms) : BaseTest(timeout_ms) {}
bool EndToEndTest::ShouldCreateReceivers() const {
return true;
diff --git a/test/configurable_frame_size_encoder.cc b/test/configurable_frame_size_encoder.cc
index 107c4cb..4fb8df4 100644
--- a/test/configurable_frame_size_encoder.cc
+++ b/test/configurable_frame_size_encoder.cc
@@ -42,8 +42,8 @@
const VideoFrame& inputImage,
const CodecSpecificInfo* codecSpecificInfo,
const std::vector<FrameType>* frame_types) {
- EncodedImage encodedImage(
- buffer_.get(), current_frame_size_, max_frame_size_);
+ EncodedImage encodedImage(buffer_.get(), current_frame_size_,
+ max_frame_size_);
encodedImage._completeFrame = true;
encodedImage._encodedHeight = inputImage.height();
encodedImage._encodedWidth = inputImage.width();
diff --git a/test/direct_transport.cc b/test/direct_transport.cc
index 4b2fd04..672e553 100644
--- a/test/direct_transport.cc
+++ b/test/direct_transport.cc
@@ -42,8 +42,7 @@
: DirectTransport(task_queue,
FakeNetworkPipe::Config(),
send_call,
- payload_type_map) {
-}
+ payload_type_map) {}
DirectTransport::DirectTransport(
SingleThreadedTaskQueueForTesting* task_queue,
@@ -139,9 +138,8 @@
fake_network_->Process();
int64_t delay_ms = fake_network_->TimeUntilNextProcess();
- next_scheduled_task_ = task_queue_->PostDelayedTask([this]() {
- SendPackets();
- }, delay_ms);
+ next_scheduled_task_ =
+ task_queue_->PostDelayedTask([this]() { SendPackets(); }, delay_ms);
}
} // namespace test
} // namespace webrtc
diff --git a/test/encoder_settings.cc b/test/encoder_settings.cc
index 33e81b0..8e21598 100644
--- a/test/encoder_settings.cc
+++ b/test/encoder_settings.cc
@@ -123,7 +123,8 @@
}
VideoReceiveStream::Decoder CreateMatchingDecoder(
- int payload_type, const std::string& payload_name) {
+ int payload_type,
+ const std::string& payload_name) {
VideoReceiveStream::Decoder decoder;
decoder.payload_type = payload_type;
decoder.payload_name = payload_name;
diff --git a/test/encoder_settings.h b/test/encoder_settings.h
index 787387b..c05ac93 100644
--- a/test/encoder_settings.h
+++ b/test/encoder_settings.h
@@ -45,11 +45,13 @@
int height,
const webrtc::VideoEncoderConfig& encoder_config);
-void FillEncoderConfiguration(VideoCodecType codec_type, size_t num_streams,
+void FillEncoderConfiguration(VideoCodecType codec_type,
+ size_t num_streams,
VideoEncoderConfig* configuration);
VideoReceiveStream::Decoder CreateMatchingDecoder(
- int payload_type, const std::string& payload_name);
+ int payload_type,
+ const std::string& payload_name);
VideoReceiveStream::Decoder CreateMatchingDecoder(
const VideoSendStream::Config& config);
diff --git a/test/fake_decoder.cc b/test/fake_decoder.cc
index 107f537..eaf12d0 100644
--- a/test/fake_decoder.cc
+++ b/test/fake_decoder.cc
@@ -81,9 +81,7 @@
}
++value;
}
- return FakeDecoder::Decode(input,
- missing_frames,
- codec_specific_info,
+ return FakeDecoder::Decode(input, missing_frames, codec_specific_info,
render_time_ms);
}
diff --git a/test/fake_encoder.cc b/test/fake_encoder.cc
index 7f7e695..12a77e3 100644
--- a/test/fake_encoder.cc
+++ b/test/fake_encoder.cc
@@ -116,8 +116,8 @@
(simulcast_streams[i].minBitrate * 1000) / framerate);
size_t max_stream_bits = static_cast<size_t>(
(simulcast_streams[i].maxBitrate * 1000) / framerate);
- size_t stream_bits = (bits_available > max_stream_bits) ? max_stream_bits :
- bits_available;
+ size_t stream_bits =
+ (bits_available > max_stream_bits) ? max_stream_bits : bits_available;
size_t stream_bytes = (stream_bits + 7) / 8;
if (keyframe) {
// The first frame is a key frame and should be larger.
@@ -172,7 +172,9 @@
return 0;
}
-int32_t FakeEncoder::Release() { return 0; }
+int32_t FakeEncoder::Release() {
+ return 0;
+}
int32_t FakeEncoder::SetChannelParameters(uint32_t packet_loss, int64_t rtt) {
return 0;
diff --git a/test/fake_encoder.h b/test/fake_encoder.h
index 2700f3d..071019a 100644
--- a/test/fake_encoder.h
+++ b/test/fake_encoder.h
@@ -11,8 +11,8 @@
#ifndef TEST_FAKE_ENCODER_H_
#define TEST_FAKE_ENCODER_H_
-#include <vector>
#include <memory>
+#include <vector>
#include "api/video_codecs/video_encoder.h"
#include "common_types.h" // NOLINT(build/include)
diff --git a/test/field_trial.cc b/test/field_trial.cc
index 9be36c5..c4d8b3c 100644
--- a/test/field_trial.cc
+++ b/test/field_trial.cc
@@ -43,8 +43,8 @@
size_t name_end = trials_string.find(kPersistentStringSeparator, next_item);
if (name_end == trials_string.npos || next_item == name_end)
break;
- size_t group_name_end = trials_string.find(kPersistentStringSeparator,
- name_end + 1);
+ size_t group_name_end =
+ trials_string.find(kPersistentStringSeparator, name_end + 1);
if (group_name_end == trials_string.npos || name_end + 1 == group_name_end)
break;
std::string name(trials_string, next_item, name_end - next_item);
@@ -74,7 +74,7 @@
}
ScopedFieldTrials::ScopedFieldTrials(const std::string& config)
- : previous_field_trials_(webrtc::field_trial::GetFieldTrialString()) {
+ : previous_field_trials_(webrtc::field_trial::GetFieldTrialString()) {
assert(field_trials_initiated_);
field_trials_initiated_ = false;
current_field_trials_ = config;
diff --git a/test/field_trial.h b/test/field_trial.h
index 40f7b1b..2d8f375 100644
--- a/test/field_trial.h
+++ b/test/field_trial.h
@@ -11,8 +11,8 @@
#ifndef TEST_FIELD_TRIAL_H_
#define TEST_FIELD_TRIAL_H_
-#include <string>
#include <map>
+#include <string>
namespace webrtc {
namespace test {
@@ -38,6 +38,7 @@
public:
explicit ScopedFieldTrials(const std::string& config);
~ScopedFieldTrials();
+
private:
std::string current_field_trials_;
const char* previous_field_trials_;
diff --git a/test/frame_generator.h b/test/frame_generator.h
index 65857af..1c108b1 100644
--- a/test/frame_generator.h
+++ b/test/frame_generator.h
@@ -99,8 +99,8 @@
// Creates a frame generator that produces randomly generated slides.
// frame_repeat_count determines how many times each slide is shown.
- static std::unique_ptr<FrameGenerator> CreateSlideGenerator(
- int width, int height, int frame_repeat_count);
+ static std::unique_ptr<FrameGenerator>
+ CreateSlideGenerator(int width, int height, int frame_repeat_count);
};
} // namespace test
} // namespace webrtc
diff --git a/test/frame_generator_capturer.cc b/test/frame_generator_capturer.cc
index 61f96fa..184fdd7 100644
--- a/test/frame_generator_capturer.cc
+++ b/test/frame_generator_capturer.cc
@@ -13,13 +13,13 @@
#include <utility>
#include <vector>
+#include "call/video_send_stream.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/logging.h"
#include "rtc_base/platform_thread.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/timeutils.h"
#include "system_wrappers/include/clock.h"
-#include "call/video_send_stream.h"
namespace webrtc {
namespace test {
@@ -125,8 +125,8 @@
int target_fps,
Clock* clock) {
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
- clock, FrameGenerator::CreateSlideGenerator(width, height,
- frame_repeat_count),
+ clock,
+ FrameGenerator::CreateSlideGenerator(width, height, frame_repeat_count),
target_fps));
if (!capturer->Init())
return nullptr;
@@ -145,8 +145,7 @@
frame_generator_(std::move(frame_generator)),
target_fps_(target_fps),
first_frame_capture_time_(-1),
- task_queue_("FrameGenCapQ",
- rtc::TaskQueue::Priority::HIGH) {
+ task_queue_("FrameGenCapQ", rtc::TaskQueue::Priority::HIGH) {
RTC_DCHECK(frame_generator_);
RTC_DCHECK_GT(target_fps, 0);
}
diff --git a/test/frame_generator_unittest.cc b/test/frame_generator_unittest.cc
index ba4627d..14e2f29 100644
--- a/test/frame_generator_unittest.cc
+++ b/test/frame_generator_unittest.cc
@@ -169,8 +169,8 @@
const int kGenCount = 9;
const int kRepeatCount = 3;
std::unique_ptr<FrameGenerator> generator(
- FrameGenerator::CreateSlideGenerator(
- kFrameWidth, kFrameHeight, kRepeatCount));
+ FrameGenerator::CreateSlideGenerator(kFrameWidth, kFrameHeight,
+ kRepeatCount));
uint64_t hashes[kGenCount];
for (int i = 0; i < kGenCount; ++i) {
hashes[i] = Hash(generator->NextFrame());
@@ -178,9 +178,9 @@
// Check that the buffer changes only every |kRepeatCount| frames.
for (int i = 1; i < kGenCount; ++i) {
if (i % kRepeatCount == 0) {
- EXPECT_NE(hashes[i-1], hashes[i]);
+ EXPECT_NE(hashes[i - 1], hashes[i]);
} else {
- EXPECT_EQ(hashes[i-1], hashes[i]);
+ EXPECT_EQ(hashes[i - 1], hashes[i]);
}
}
}
diff --git a/test/frame_utils.cc b/test/frame_utils.cc
index 1d5fe7c..833f571 100644
--- a/test/frame_utils.cc
+++ b/test/frame_utils.cc
@@ -59,18 +59,17 @@
rtc::scoped_refptr<webrtc::I420BufferInterface> f1_i420 = f1->ToI420();
rtc::scoped_refptr<webrtc::I420BufferInterface> f2_i420 = f2->ToI420();
- return EqualPlane(f1_i420->DataY(), f2_i420->DataY(),
- f1_i420->StrideY(), f2_i420->StrideY(),
- f1_i420->width(), f1_i420->height()) &&
- EqualPlane(f1_i420->DataU(), f2_i420->DataU(),
- f1_i420->StrideU(), f2_i420->StrideU(),
- f1_i420->ChromaWidth(), f1_i420->ChromaHeight()) &&
- EqualPlane(f1_i420->DataV(), f2_i420->DataV(),
- f1_i420->StrideV(), f2_i420->StrideV(),
- f1_i420->ChromaWidth(), f1_i420->ChromaHeight());
+ return EqualPlane(f1_i420->DataY(), f2_i420->DataY(), f1_i420->StrideY(),
+ f2_i420->StrideY(), f1_i420->width(), f1_i420->height()) &&
+ EqualPlane(f1_i420->DataU(), f2_i420->DataU(), f1_i420->StrideU(),
+ f2_i420->StrideU(), f1_i420->ChromaWidth(),
+ f1_i420->ChromaHeight()) &&
+ EqualPlane(f1_i420->DataV(), f2_i420->DataV(), f1_i420->StrideV(),
+ f2_i420->StrideV(), f1_i420->ChromaWidth(),
+ f1_i420->ChromaHeight());
}
-rtc::scoped_refptr<I420Buffer> ReadI420Buffer(int width, int height, FILE *f) {
+rtc::scoped_refptr<I420Buffer> ReadI420Buffer(int width, int height, FILE* f) {
int half_width = (width + 1) / 2;
rtc::scoped_refptr<I420Buffer> buffer(
// Explicit stride, no padding between rows.
diff --git a/test/frame_utils.h b/test/frame_utils.h
index 80466e1..c829311 100644
--- a/test/frame_utils.h
+++ b/test/frame_utils.h
@@ -40,7 +40,7 @@
bool FrameBufsEqual(const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& f1,
const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& f2);
-rtc::scoped_refptr<I420Buffer> ReadI420Buffer(int width, int height, FILE *);
+rtc::scoped_refptr<I420Buffer> ReadI420Buffer(int width, int height, FILE*);
} // namespace test
} // namespace webrtc
diff --git a/test/fuzzers/flexfec_sender_fuzzer.cc b/test/fuzzers/flexfec_sender_fuzzer.cc
index ab08850..8e79f95 100644
--- a/test/fuzzers/flexfec_sender_fuzzer.cc
+++ b/test/fuzzers/flexfec_sender_fuzzer.cc
@@ -12,8 +12,8 @@
#include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
-#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "modules/rtp_rtcp/source/byte_io.h"
+#include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
diff --git a/test/fuzzers/packet_buffer_fuzzer.cc b/test/fuzzers/packet_buffer_fuzzer.cc
index 7f116f6..7b52ee0 100644
--- a/test/fuzzers/packet_buffer_fuzzer.cc
+++ b/test/fuzzers/packet_buffer_fuzzer.cc
@@ -20,7 +20,6 @@
} // namespace
void FuzzOneInput(const uint8_t* data, size_t size) {
-
VCMPacket packet;
NullCallback callback;
SimulatedClock clock(0);
diff --git a/test/fuzzers/pseudotcp_parser_fuzzer.cc b/test/fuzzers/pseudotcp_parser_fuzzer.cc
index 90123c3..bab09df 100644
--- a/test/fuzzers/pseudotcp_parser_fuzzer.cc
+++ b/test/fuzzers/pseudotcp_parser_fuzzer.cc
@@ -1,12 +1,12 @@
/*
-* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
-*
-* Use of this source code is governed by a BSD-style license
-* that can be found in the LICENSE file in the root of the source
-* tree. An additional intellectual property rights grant can be found
-* in the file PATENTS. All contributing project authors may
-* be found in the AUTHORS file in the root of the source tree.
-*/
+ * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
#include <stddef.h>
#include <stdint.h>
@@ -30,9 +30,8 @@
};
struct Environment {
- explicit Environment(cricket::IPseudoTcpNotify* notifier):
- ptcp(notifier, 0) {
- }
+ explicit Environment(cricket::IPseudoTcpNotify* notifier)
+ : ptcp(notifier, 0) {}
// We need the thread to avoid some uninteresting crashes, since the
// production code expects there to be a thread object available.
diff --git a/test/fuzzers/rtcp_receiver_fuzzer.cc b/test/fuzzers/rtcp_receiver_fuzzer.cc
index 8782f0c..d87e002 100644
--- a/test/fuzzers/rtcp_receiver_fuzzer.cc
+++ b/test/fuzzers/rtcp_receiver_fuzzer.cc
@@ -18,11 +18,11 @@
public:
void SetTmmbn(std::vector<rtcp::TmmbItem>) override {}
void OnRequestSendReport() override {}
- void OnReceivedNack(const std::vector<uint16_t>&) override {};
- void OnReceivedRtcpReportBlocks(const ReportBlockList&) override {};
+ void OnReceivedNack(const std::vector<uint16_t>&) override{};
+ void OnReceivedRtcpReportBlocks(const ReportBlockList&) override{};
};
-}
+} // namespace
void FuzzOneInput(const uint8_t* data, size_t size) {
NullModuleRtpRtcp rtp_rtcp_module;
@@ -34,4 +34,3 @@
receiver.IncomingPacket(data, size);
}
} // namespace webrtc
-
diff --git a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
index 9c47805..30c4df4 100644
--- a/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
+++ b/test/fuzzers/rtp_frame_reference_finder_fuzzer.cc
@@ -62,9 +62,15 @@
explicit FuzzyPacketBuffer(DataReader* reader)
: PacketBuffer(nullptr, 2, 4, nullptr), reader(reader) {
switch (reader->GetNum<uint8_t>() % 3) {
- case 0: codec = kVideoCodecVP8; break;
- case 1: codec = kVideoCodecVP9; break;
- case 2: codec = kVideoCodecH264; break;
+ case 0:
+ codec = kVideoCodecVP8;
+ break;
+ case 1:
+ codec = kVideoCodecVP9;
+ break;
+ case 2:
+ codec = kVideoCodecH264;
+ break;
}
}
diff --git a/test/fuzzers/ulpfec_generator_fuzzer.cc b/test/fuzzers/ulpfec_generator_fuzzer.cc
index ba9a53a..2536b54 100644
--- a/test/fuzzers/ulpfec_generator_fuzzer.cc
+++ b/test/fuzzers/ulpfec_generator_fuzzer.cc
@@ -58,7 +58,8 @@
const size_t num_fec_packets = generator.NumAvailableFecPackets();
if (num_fec_packets > 0) {
std::vector<std::unique_ptr<RedPacket>> fec_packets =
- generator.GetUlpfecPacketsAsRed(kRedPayloadType, kFecPayloadType, 100);
+ generator.GetUlpfecPacketsAsRed(kRedPayloadType, kFecPayloadType,
+ 100);
RTC_CHECK_EQ(num_fec_packets, fec_packets.size());
}
}
diff --git a/test/fuzzers/ulpfec_receiver_fuzzer.cc b/test/fuzzers/ulpfec_receiver_fuzzer.cc
index 25b53ed..6b74f3a 100644
--- a/test/fuzzers/ulpfec_receiver_fuzzer.cc
+++ b/test/fuzzers/ulpfec_receiver_fuzzer.cc
@@ -10,8 +10,8 @@
#include <algorithm>
-#include "modules/rtp_rtcp/include/ulpfec_receiver.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
+#include "modules/rtp_rtcp/include/ulpfec_receiver.h"
#include "modules/rtp_rtcp/source/byte_io.h"
#include "modules/rtp_rtcp/source/rtp_packet_received.h"
@@ -67,8 +67,8 @@
RTPHeader parsed_header;
if (parsed_packet.Parse(packet.get(), packet_length)) {
parsed_packet.GetHeader(&parsed_header);
- receiver->AddReceivedRedPacket(parsed_header, packet.get(),
- packet_length, 0);
+ receiver->AddReceivedRedPacket(parsed_header, packet.get(), packet_length,
+ 0);
}
}
diff --git a/test/fuzzers/webrtc_fuzzer_main.cc b/test/fuzzers/webrtc_fuzzer_main.cc
index ca4bc15..a52dd23 100644
--- a/test/fuzzers/webrtc_fuzzer_main.cc
+++ b/test/fuzzers/webrtc_fuzzer_main.cc
@@ -20,21 +20,21 @@
if (g_initialized)
return;
- // Remove default logging to prevent huge slowdowns.
- // TODO(pbos): Disable in Chromium: http://crbug.com/561667
+// Remove default logging to prevent huge slowdowns.
+// TODO(pbos): Disable in Chromium: http://crbug.com/561667
#if !defined(WEBRTC_CHROMIUM_BUILD)
rtc::LogMessage::LogToDebug(rtc::LS_NONE);
#endif // !defined(WEBRTC_CHROMIUM_BUILD)
g_initialized = true;
}
-}
+} // namespace
namespace webrtc {
extern void FuzzOneInput(const uint8_t* data, size_t size);
} // namespace webrtc
-extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, size_t size) {
InitializeWebRtcFuzzDefaults();
webrtc::FuzzOneInput(data, size);
return 0;
diff --git a/test/gl/gl_renderer.cc b/test/gl/gl_renderer.cc
index ef7ab9c..10162ee 100644
--- a/test/gl/gl_renderer.cc
+++ b/test/gl/gl_renderer.cc
@@ -108,5 +108,5 @@
glBindTexture(GL_TEXTURE_2D, 0);
glFlush();
}
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
diff --git a/test/gl/gl_renderer.h b/test/gl/gl_renderer.h
index 382739d..16f432b 100644
--- a/test/gl/gl_renderer.h
+++ b/test/gl/gl_renderer.h
@@ -20,7 +20,6 @@
#include "test/video_renderer.h"
#include "typedefs.h" // NOLINT(build/include)
-
namespace webrtc {
namespace test {
@@ -44,7 +43,7 @@
void ResizeVideo(size_t width, size_t height);
};
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
#endif // TEST_GL_GL_RENDERER_H_
diff --git a/test/ios/test_support.h b/test/ios/test_support.h
index 0178fca..2c5b600 100644
--- a/test/ios/test_support.h
+++ b/test/ios/test_support.h
@@ -17,7 +17,9 @@
// This is necessary as iOS doesn't like processes without a gui
// running for longer than a few seconds.
void RunTestsFromIOSApp();
-void InitTestSuite(int (*test_suite)(void), int argc, char* argv[],
+void InitTestSuite(int (*test_suite)(void),
+ int argc,
+ char* argv[],
bool save_chartjson_result);
} // namespace test
diff --git a/test/linux/glx_renderer.cc b/test/linux/glx_renderer.cc
index 4dbf1c9..aaff84b 100644
--- a/test/linux/glx_renderer.cc
+++ b/test/linux/glx_renderer.cc
@@ -22,15 +22,14 @@
namespace test {
GlxRenderer::GlxRenderer(size_t width, size_t height)
- : width_(width),
- height_(height),
- display_(NULL),
- context_(NULL) {
+ : width_(width), height_(height), display_(NULL), context_(NULL) {
assert(width > 0);
assert(height > 0);
}
-GlxRenderer::~GlxRenderer() { Destroy(); }
+GlxRenderer::~GlxRenderer() {
+ Destroy();
+}
bool GlxRenderer::Init(const char* window_title) {
if ((display_ = XOpenDisplay(NULL)) == NULL) {
@@ -41,9 +40,10 @@
int screen = DefaultScreen(display_);
XVisualInfo* vi;
- int attr_list[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_RED_SIZE, 4,
- GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16,
- None, };
+ int attr_list[] = {
+ GLX_DOUBLEBUFFER, GLX_RGBA, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4,
+ GLX_BLUE_SIZE, 4, GLX_DEPTH_SIZE, 16, None,
+ };
if ((vi = glXChooseVisual(display_, screen, attr_list)) == NULL) {
Destroy();
@@ -106,7 +106,8 @@
}
}
-GlxRenderer* GlxRenderer::Create(const char* window_title, size_t width,
+GlxRenderer* GlxRenderer::Create(const char* window_title,
+ size_t width,
size_t height) {
GlxRenderer* glx_renderer = new GlxRenderer(width, height);
if (!glx_renderer->Init(window_title)) {
@@ -174,5 +175,5 @@
abort();
}
}
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
diff --git a/test/linux/glx_renderer.h b/test/linux/glx_renderer.h
index 63ef624..ec8b3dd 100644
--- a/test/linux/glx_renderer.h
+++ b/test/linux/glx_renderer.h
@@ -22,7 +22,8 @@
class GlxRenderer : public GlRenderer {
public:
- static GlxRenderer* Create(const char* window_title, size_t width,
+ static GlxRenderer* Create(const char* window_title,
+ size_t width,
size_t height);
virtual ~GlxRenderer();
@@ -41,7 +42,7 @@
Window window_;
GLXContext context_;
};
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
#endif // TEST_LINUX_GLX_RENDERER_H_
diff --git a/test/linux/video_renderer_linux.cc b/test/linux/video_renderer_linux.cc
index 9428489..da0b792 100644
--- a/test/linux/video_renderer_linux.cc
+++ b/test/linux/video_renderer_linux.cc
@@ -23,5 +23,5 @@
}
return NULL;
}
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
diff --git a/test/mac/video_renderer_mac.h b/test/mac/video_renderer_mac.h
index 19349c0..e6499f0 100644
--- a/test/mac/video_renderer_mac.h
+++ b/test/mac/video_renderer_mac.h
@@ -34,7 +34,7 @@
RTC_DISALLOW_COPY_AND_ASSIGN(MacRenderer);
};
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
#endif // TEST_MAC_VIDEO_RENDERER_MAC_H_
diff --git a/test/null_platform_renderer.cc b/test/null_platform_renderer.cc
index 48e4cc0..7ea604ea 100644
--- a/test/null_platform_renderer.cc
+++ b/test/null_platform_renderer.cc
@@ -18,5 +18,5 @@
size_t height) {
return NULL;
}
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
diff --git a/test/rtp_file_reader.cc b/test/rtp_file_reader.cc
index 032ec4e..17d4d14 100644
--- a/test/rtp_file_reader.cc
+++ b/test/rtp_file_reader.cc
@@ -241,17 +241,17 @@
class PcapReader : public RtpFileReaderImpl {
public:
PcapReader()
- : file_(NULL),
- swap_pcap_byte_order_(false),
+ : file_(NULL),
+ swap_pcap_byte_order_(false),
#ifdef WEBRTC_ARCH_BIG_ENDIAN
- swap_network_byte_order_(false),
+ swap_network_byte_order_(false),
#else
- swap_network_byte_order_(true),
+ swap_network_byte_order_(true),
#endif
- read_buffer_(),
- packets_by_ssrc_(),
- packets_(),
- next_packet_it_() {
+ read_buffer_(),
+ packets_by_ssrc_(),
+ packets_(),
+ next_packet_it_() {
}
virtual ~PcapReader() {
@@ -304,7 +304,7 @@
printf("Total RTP/RTCP packets: %" PRIuS "\n", packets_.size());
for (SsrcMapIterator mit = packets_by_ssrc_.begin();
- mit != packets_by_ssrc_.end(); ++mit) {
+ mit != packets_by_ssrc_.end(); ++mit) {
uint32_t ssrc = mit->first;
const std::vector<uint32_t>& packet_indices = mit->second;
uint8_t pt = packets_[packet_indices[0]].rtp_header.payloadType;
@@ -364,14 +364,14 @@
private:
// A marker of an RTP packet within the file.
struct RtpPacketMarker {
- uint32_t packet_number; // One-based index (like in WireShark)
+ uint32_t packet_number; // One-based index (like in WireShark)
uint32_t time_offset_ms;
uint32_t source_ip;
uint32_t dest_ip;
uint16_t source_port;
uint16_t dest_port;
RTPHeader rtp_header;
- int32_t pos_in_file; // Byte offset of payload from start of file.
+ int32_t pos_in_file; // Byte offset of payload from start of file.
uint32_t payload_length;
};
@@ -505,8 +505,8 @@
uint32_t CalcTimeDelta(uint32_t ts_sec, uint32_t ts_usec, uint32_t start_ms) {
// Round to nearest ms.
- uint64_t t2_ms = ((static_cast<uint64_t>(ts_sec) * 1000000) + ts_usec +
- 500) / 1000;
+ uint64_t t2_ms =
+ ((static_cast<uint64_t>(ts_sec) * 1000000) + ts_usec + 500) / 1000;
uint64_t t1_ms = static_cast<uint64_t>(start_ms);
if (t2_ms < t1_ms) {
return 0;
@@ -577,7 +577,7 @@
if ((!expect_network_order && swap_pcap_byte_order_) ||
(expect_network_order && swap_network_byte_order_)) {
tmp = ((tmp >> 24) & 0x000000ff) | (tmp << 24) |
- ((tmp >> 8) & 0x0000ff00) | ((tmp << 8) & 0x00ff0000);
+ ((tmp >> 8) & 0x0000ff00) | ((tmp << 8) & 0x00ff0000);
}
*out = tmp;
return kResultSuccess;
@@ -611,7 +611,7 @@
if ((!expect_network_order && swap_pcap_byte_order_) ||
(expect_network_order && swap_network_byte_order_)) {
tmp = ((tmp >> 24) & 0x000000ff) | (tmp << 24) |
- ((tmp >> 8) & 0x0000ff00) | ((tmp << 8) & 0x00ff0000);
+ ((tmp >> 8) & 0x0000ff00) | ((tmp << 8) & 0x00ff0000);
}
*out = tmp;
return kResultSuccess;
diff --git a/test/rtp_file_reader.h b/test/rtp_file_reader.h
index c044d3d..4913522 100644
--- a/test/rtp_file_reader.h
+++ b/test/rtp_file_reader.h
@@ -36,8 +36,7 @@
enum FileFormat { kPcap, kRtpDump, kLengthPacketInterleaved };
virtual ~RtpFileReader() {}
- static RtpFileReader* Create(FileFormat format,
- const std::string& filename);
+ static RtpFileReader* Create(FileFormat format, const std::string& filename);
static RtpFileReader* Create(FileFormat format,
const std::string& filename,
const std::set<uint32_t>& ssrc_filter);
diff --git a/test/rtp_rtcp_observer.h b/test/rtp_rtcp_observer.h
index 1f213b4..99c8b73 100644
--- a/test/rtp_rtcp_observer.h
+++ b/test/rtp_rtcp_observer.h
@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
+#include "call/video_send_stream.h"
#include "modules/rtp_rtcp/include/rtp_header_parser.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/event.h"
@@ -22,7 +23,6 @@
#include "test/direct_transport.h"
#include "test/gtest.h"
#include "typedefs.h" // NOLINT(build/include)
-#include "call/video_send_stream.h"
namespace {
const int kShortTimeoutMs = 500;
diff --git a/test/run_loop.cc b/test/run_loop.cc
index 0d00ecd..dc2ec18 100644
--- a/test/run_loop.cc
+++ b/test/run_loop.cc
@@ -16,7 +16,8 @@
void PressEnterToContinue() {
puts(">> Press ENTER to continue...");
- while (getc(stdin) != '\n' && !feof(stdin));
+ while (getc(stdin) != '\n' && !feof(stdin))
+ ;
}
} // namespace test
} // namespace webrtc
diff --git a/test/run_test.cc b/test/run_test.cc
index ba0bf34..9f6126c 100644
--- a/test/run_test.cc
+++ b/test/run_test.cc
@@ -15,7 +15,7 @@
namespace webrtc {
namespace test {
-void RunTest(void(*test)()) {
+void RunTest(void (*test)()) {
(*test)();
}
diff --git a/test/run_test.h b/test/run_test.h
index ed90857..bd05584 100644
--- a/test/run_test.h
+++ b/test/run_test.h
@@ -14,7 +14,7 @@
namespace test {
// Running a test function on a separate thread, if required by the OS.
-void RunTest(void(*test)());
+void RunTest(void (*test)());
} // namespace test
} // namespace webrtc
diff --git a/test/single_threaded_task_queue_unittest.cc b/test/single_threaded_task_queue_unittest.cc
index 5bd40d7..3929574 100644
--- a/test/single_threaded_task_queue_unittest.cc
+++ b/test/single_threaded_task_queue_unittest.cc
@@ -68,9 +68,8 @@
// queue at any given time, post one waiting task that would block the
// task-queue, and unblock only after all tasks have been posted.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
// Post the tasks which comprise the test.
for (size_t i = 0; i < kCount; i++) {
@@ -126,9 +125,8 @@
// Prevent the chain from being set in motion before we've had time to
// schedule it all, lest the queue only contain one task at a time.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
for (size_t i = 0; i < 3; i++) {
task_queue.PostTask([&accumulator, i]() { // |i| passed by value.
@@ -139,9 +137,7 @@
// The test will wait for the task-queue to finish.
rtc::Event done(true, false);
- task_queue.PostTask([&done]() {
- done.Set();
- });
+ task_queue.PostTask([&done]() { done.Set(); });
rendezvous.Set(); // Set the chain in motion.
@@ -159,10 +155,12 @@
constexpr int64_t delay_ms = 20;
static_assert(delay_ms < kMaxWaitTimeMs / 2, "Delay too long for tests.");
- task_queue.PostDelayedTask([&executed, &done]() {
- executed.store(true);
- done.Set();
- }, delay_ms);
+ task_queue.PostDelayedTask(
+ [&executed, &done]() {
+ executed.store(true);
+ done.Set();
+ },
+ delay_ms);
ASSERT_TRUE(done.Wait(kMaxWaitTimeMs));
EXPECT_TRUE(executed.load());
@@ -176,9 +174,7 @@
constexpr int64_t delay_ms = 2000;
static_assert(delay_ms < kMaxWaitTimeMs / 2, "Delay too long for tests.");
- task_queue.PostDelayedTask([&executed]() {
- executed.store(true);
- }, delay_ms);
+ task_queue.PostDelayedTask([&executed]() { executed.store(true); }, delay_ms);
// Wait less than is enough, make sure the task was not yet executed.
rtc::Event not_done(true, false);
@@ -262,16 +258,11 @@
// Prevent the to-be-cancelled task from being executed before we've had
// time to cancel it.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
- TaskId cancelled_task_id = task_queue.PostTask([]() {
- EXPECT_TRUE(false);
- });
- task_queue.PostTask([&done]() {
- done.Set();
- });
+ TaskId cancelled_task_id = task_queue.PostTask([]() { EXPECT_TRUE(false); });
+ task_queue.PostTask([&done]() { done.Set(); });
task_queue.CancelTask(cancelled_task_id);
@@ -292,9 +283,8 @@
// Prevent the chain from being set-off before we've set everything up.
rtc::Event rendezvous(true, false);
- task_queue.PostTask([&rendezvous]() {
- ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs));
- });
+ task_queue.PostTask(
+ [&rendezvous]() { ASSERT_TRUE(rendezvous.Wait(kMaxWaitTimeMs)); });
// This is the canceller-task. It takes cancelled_task_id by reference,
// because the ID will only become known after the cancelled task is
@@ -306,15 +296,11 @@
task_queue.PostTask(canceller_task);
// This task will be cancelled by the task before it.
- auto cancelled_task = []() {
- EXPECT_TRUE(false);
- };
+ auto cancelled_task = []() { EXPECT_TRUE(false); };
cancelled_task_id = task_queue.PostTask(cancelled_task);
// When this task runs, it will allow the test to be finished.
- auto completion_marker_task = [&done]() {
- done.Set();
- };
+ auto completion_marker_task = [&done]() { done.Set(); };
task_queue.PostTask(completion_marker_task);
rendezvous.Set(); // Set the chain in motion.
diff --git a/test/test_main.cc b/test/test_main.cc
index cb99564..277d420 100644
--- a/test/test_main.cc
+++ b/test/test_main.cc
@@ -21,10 +21,12 @@
#if defined(WEBRTC_IOS)
#include "test/ios/test_support.h"
-DEFINE_string(NSTreatUnknownArgumentsAsOpen, "",
- "Intentionally ignored flag intended for iOS simulator.");
-DEFINE_string(ApplePersistenceIgnoreState, "",
- "Intentionally ignored flag intended for iOS simulator.");
+DEFINE_string(NSTreatUnknownArgumentsAsOpen,
+ "",
+ "Intentionally ignored flag intended for iOS simulator.");
+DEFINE_string(ApplePersistenceIgnoreState,
+ "",
+ "Intentionally ignored flag intended for iOS simulator.");
DEFINE_bool(
save_chartjson_result,
false,
@@ -35,10 +37,9 @@
#else
-DEFINE_string(
- isolated_script_test_output,
- "",
- "Intentionally ignored flag intended for Chromium.");
+DEFINE_string(isolated_script_test_output,
+ "",
+ "Intentionally ignored flag intended for Chromium.");
DEFINE_string(
isolated_script_test_perf_output,
@@ -52,7 +53,9 @@
DEFINE_bool(logs, false, "print logs to stderr");
-DEFINE_string(force_fieldtrials, "",
+DEFINE_string(
+ force_fieldtrials,
+ "",
"Field trials control experimental feature code which can be forced. "
"E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
" will assign the group Enable to field trial WebRTC-FooFeature.");
@@ -82,7 +85,6 @@
webrtc::field_trial::InitFieldTrialsFromString(FLAG_force_fieldtrials);
webrtc::metrics::Enable();
-
rtc::LogMessage::SetLogToStderr(FLAG_logs);
#if defined(WEBRTC_IOS)
diff --git a/test/testsupport/fileutils.cc b/test/testsupport/fileutils.cc
index 76a635a..119f6cc 100644
--- a/test/testsupport/fileutils.cc
+++ b/test/testsupport/fileutils.cc
@@ -31,8 +31,8 @@
#endif
#include <sys/stat.h> // To check for directory existence.
-#ifndef S_ISDIR // Not defined in stat.h on Windows.
-#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+#ifndef S_ISDIR // Not defined in stat.h on Windows.
+#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
#endif
#include <stdio.h>
@@ -92,9 +92,9 @@
if (path.find(working_dir) != std::string::npos) {
temp_path = path.substr(working_dir.length() + 1);
}
- // On Windows, when tests are run under memory tools like DrMemory and TSan,
- // slashes occur in the path as directory separators. Make sure we replace
- // such cases with backslashes in order for the paths to be correct.
+// On Windows, when tests are run under memory tools like DrMemory and TSan,
+// slashes occur in the path as directory separators. Make sure we replace
+// such cases with backslashes in order for the paths to be correct.
#ifdef WIN32
std::replace(temp_path.begin(), temp_path.end(), '/', '\\');
#endif
@@ -112,8 +112,8 @@
bool DirExists(const std::string& directory_name) {
struct stat directory_info = {0};
- return stat(directory_name.c_str(), &directory_info) == 0 && S_ISDIR(
- directory_info.st_mode);
+ return stat(directory_name.c_str(), &directory_info) == 0 &&
+ S_ISDIR(directory_info.st_mode);
}
#ifdef WEBRTC_ANDROID
@@ -190,11 +190,11 @@
// Generate a temporary filename in a safe way.
// Largely copied from talk/base/{unixfilesystem,win32filesystem}.cc.
-std::string TempFilename(const std::string &dir, const std::string &prefix) {
+std::string TempFilename(const std::string& dir, const std::string& prefix) {
#ifdef WIN32
wchar_t filename[MAX_PATH];
- if (::GetTempFileName(rtc::ToUtf16(dir).c_str(),
- rtc::ToUtf16(prefix).c_str(), 0, filename) != 0)
+ if (::GetTempFileName(rtc::ToUtf16(dir).c_str(), rtc::ToUtf16(prefix).c_str(),
+ 0, filename) != 0)
return rtc::ToUtf8(filename);
assert(false);
return "";
@@ -202,8 +202,7 @@
int len = dir.size() + prefix.size() + 2 + 6;
std::unique_ptr<char[]> tempname(new char[len]);
- snprintf(tempname.get(), len, "%s/%sXXXXXX", dir.c_str(),
- prefix.c_str());
+ snprintf(tempname.get(), len, "%s/%sXXXXXX", dir.c_str(), prefix.c_str());
int fd = ::mkstemp(tempname.get());
if (fd == -1) {
assert(false);
@@ -279,7 +278,8 @@
// Check if the path exists already:
if (stat(directory_name.c_str(), &path_info) == 0) {
if (!S_ISDIR(path_info.st_mode)) {
- fprintf(stderr, "Path %s exists but is not a directory! Remove this "
+ fprintf(stderr,
+ "Path %s exists but is not a directory! Remove this "
"file and re-run to create the directory.\n",
directory_name.c_str());
return false;
@@ -288,7 +288,7 @@
#ifdef WIN32
return _mkdir(directory_name.c_str()) == 0;
#else
- return mkdir(directory_name.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0;
+ return mkdir(directory_name.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) == 0;
#endif
}
return true;
@@ -296,9 +296,9 @@
bool RemoveDir(const std::string& directory_name) {
#ifdef WIN32
- return RemoveDirectoryA(directory_name.c_str()) != FALSE;
+ return RemoveDirectoryA(directory_name.c_str()) != FALSE;
#else
- return rmdir(directory_name.c_str()) == 0;
+ return rmdir(directory_name.c_str()) == 0;
#endif
}
@@ -332,10 +332,10 @@
std::string architecture = "32";
#endif // WEBRTC_ARCH_64_BITS
- std::string resources_path = ProjectRootPath() + kResourcesDirName +
- kPathDelimiter;
+ std::string resources_path =
+ ProjectRootPath() + kResourcesDirName + kPathDelimiter;
std::string resource_file = resources_path + name + "_" + platform + "_" +
- architecture + "." + extension;
+ architecture + "." + extension;
if (FileExists(resource_file)) {
return resource_file;
}
diff --git a/test/testsupport/fileutils.h b/test/testsupport/fileutils.h
index af39a94..8cef0e3 100644
--- a/test/testsupport/fileutils.h
+++ b/test/testsupport/fileutils.h
@@ -41,7 +41,7 @@
// Generates an empty file with a unique name in the specified directory and
// returns the file name and path.
// TODO(titovartem) rename to TempFile and next method to TempFilename
-std::string TempFilename(const std::string &dir, const std::string &prefix);
+std::string TempFilename(const std::string& dir, const std::string& prefix);
// Generates a unique file name that can be used for file creation. Doesn't
// create any files.
diff --git a/test/testsupport/fileutils_unittest.cc b/test/testsupport/fileutils_unittest.cc
index b39be6f..dc1f1bc 100644
--- a/test/testsupport/fileutils_unittest.cc
+++ b/test/testsupport/fileutils_unittest.cc
@@ -69,19 +69,17 @@
// gtest framework).
class FileUtilsTest : public testing::Test {
protected:
- FileUtilsTest() {
- }
+ FileUtilsTest() {}
~FileUtilsTest() override {}
// Runs before the first test
static void SetUpTestCase() {
original_working_dir_ = webrtc::test::WorkingDir();
}
- void SetUp() override {
- ASSERT_EQ(chdir(original_working_dir_.c_str()), 0);
- }
+ void SetUp() override { ASSERT_EQ(chdir(original_working_dir_.c_str()), 0); }
void TearDown() override {
ASSERT_EQ(chdir(original_working_dir_.c_str()), 0);
}
+
private:
static std::string original_working_dir_;
};
@@ -186,8 +184,8 @@
webrtc::test::OutputPath(), "fileutils_unittest");
FILE* file = fopen(temp_filename.c_str(), "wb");
ASSERT_TRUE(file != NULL) << "Failed to open file: " << temp_filename;
- ASSERT_GT(fprintf(file, "%s", "Dummy data"), 0) <<
- "Failed to write to file: " << temp_filename;
+ ASSERT_GT(fprintf(file, "%s", "Dummy data"), 0)
+ << "Failed to write to file: " << temp_filename;
fclose(file);
ASSERT_GT(webrtc::test::GetFileSize(std::string(temp_filename.c_str())), 0u);
remove(temp_filename.c_str());
diff --git a/test/testsupport/frame_writer.h b/test/testsupport/frame_writer.h
index 7556050..be9adb6 100644
--- a/test/testsupport/frame_writer.h
+++ b/test/testsupport/frame_writer.h
@@ -86,7 +86,7 @@
// LibJpeg is not available on iOS. This class will do nothing on iOS.
class JpegFrameWriter {
public:
- JpegFrameWriter(const std::string &output_filename);
+ JpegFrameWriter(const std::string& output_filename);
// Quality can be from 0 (worst) to 100 (best). Best quality is still lossy.
// WriteFrame can be called only once. Subsequent calls will fail.
bool WriteFrame(const VideoFrame& input_frame, int quality);
diff --git a/test/testsupport/jpeg_frame_writer.cc b/test/testsupport/jpeg_frame_writer.cc
index 4888f65..537e85c 100644
--- a/test/testsupport/jpeg_frame_writer.cc
+++ b/test/testsupport/jpeg_frame_writer.cc
@@ -10,7 +10,6 @@
#include <stdio.h>
-
#include "common_types.h" // NOLINT(build/include)
#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "rtc_base/checks.h"
@@ -29,7 +28,7 @@
namespace webrtc {
namespace test {
-JpegFrameWriter::JpegFrameWriter(const std::string &output_filename)
+JpegFrameWriter::JpegFrameWriter(const std::string& output_filename)
: frame_written_(false),
output_filename_(output_filename),
output_file_(nullptr) {}
diff --git a/test/testsupport/jpeg_frame_writer_ios.cc b/test/testsupport/jpeg_frame_writer_ios.cc
index 567e75e..e72fea1 100644
--- a/test/testsupport/jpeg_frame_writer_ios.cc
+++ b/test/testsupport/jpeg_frame_writer_ios.cc
@@ -12,7 +12,6 @@
#include "rtc_base/logging.h"
#include "test/testsupport/frame_writer.h"
-
namespace webrtc {
namespace test {
diff --git a/test/testsupport/perf_test.cc b/test/testsupport/perf_test.cc
index b79c706..c59c071 100644
--- a/test/testsupport/perf_test.cc
+++ b/test/testsupport/perf_test.cc
@@ -121,8 +121,7 @@
}
rtc::CriticalSection crit_;
- FILE* output_
- RTC_GUARDED_BY(&crit_);
+ FILE* output_ RTC_GUARDED_BY(&crit_);
std::map<std::string, std::vector<std::string>> graphs_
RTC_GUARDED_BY(&crit_);
};
diff --git a/test/testsupport/perf_test_unittest.cc b/test/testsupport/perf_test_unittest.cc
index bd8e85f..ac2b8b9 100644
--- a/test/testsupport/perf_test_unittest.cc
+++ b/test/testsupport/perf_test_unittest.cc
@@ -60,12 +60,9 @@
class PerfTest : public ::testing::Test {
protected:
- void TearDown() override {
- ClearPerfResults();
- }
+ void TearDown() override { ClearPerfResults(); }
};
-
#if defined(WEBRTC_IOS)
#define MAYBE_TestPrintResult DISABLED_TestPrintResult
#else
diff --git a/test/testsupport/test_artifacts.cc b/test/testsupport/test_artifacts.cc
index e9d31bb..0f7e0cd 100644
--- a/test/testsupport/test_artifacts.cc
+++ b/test/testsupport/test_artifacts.cc
@@ -22,7 +22,7 @@
static const std::string path = webrtc::test::OutputPath();
return path;
}
-}
+} // namespace
DEFINE_string(test_artifacts_dir,
DefaultArtifactPath().c_str(),
diff --git a/test/vcm_capturer.cc b/test/vcm_capturer.cc
index 22631ac..3e4e0f6 100644
--- a/test/vcm_capturer.cc
+++ b/test/vcm_capturer.cc
@@ -10,9 +10,9 @@
#include "test/vcm_capturer.h"
+#include "call/video_send_stream.h"
#include "modules/video_capture/video_capture_factory.h"
#include "rtc_base/logging.h"
-#include "call/video_send_stream.h"
namespace webrtc {
namespace test {
@@ -68,7 +68,6 @@
return vcm_capturer.release();
}
-
void VcmCapturer::Start() {
rtc::CritScope lock(&crit_);
started_ = true;
@@ -103,7 +102,9 @@
vcm_ = nullptr;
}
-VcmCapturer::~VcmCapturer() { Destroy(); }
+VcmCapturer::~VcmCapturer() {
+ Destroy();
+}
void VcmCapturer::OnFrame(const VideoFrame& frame) {
rtc::CritScope lock(&crit_);
@@ -114,5 +115,5 @@
}
}
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
diff --git a/test/vcm_capturer.h b/test/vcm_capturer.h
index 9d158c3..524cfe4 100644
--- a/test/vcm_capturer.h
+++ b/test/vcm_capturer.h
@@ -22,9 +22,8 @@
namespace webrtc {
namespace test {
-class VcmCapturer
- : public VideoCapturer,
- public rtc::VideoSinkInterface<VideoFrame> {
+class VcmCapturer : public VideoCapturer,
+ public rtc::VideoSinkInterface<VideoFrame> {
public:
static VcmCapturer* Create(size_t width,
size_t height,
@@ -55,7 +54,7 @@
VideoCaptureCapability capability_;
};
-} // test
-} // webrtc
+} // namespace test
+} // namespace webrtc
#endif // TEST_VCM_CAPTURER_H_
diff --git a/test/video_renderer.h b/test/video_renderer.h
index 17815c1..9e580f6 100644
--- a/test/video_renderer.h
+++ b/test/video_renderer.h
@@ -22,7 +22,8 @@
public:
// Creates a platform-specific renderer if possible, or a null implementation
// if failing.
- static VideoRenderer* Create(const char* window_title, size_t width,
+ static VideoRenderer* Create(const char* window_title,
+ size_t width,
size_t height);
// Returns a renderer rendering to a platform specific window if possible,
// NULL if none can be created.
@@ -30,8 +31,10 @@
// platform renderer could not be created. This occurs, for instance, when
// running without an X environment on Linux.
static VideoRenderer* CreatePlatformRenderer(const char* window_title,
- size_t width, size_t height);
+ size_t width,
+ size_t height);
virtual ~VideoRenderer() {}
+
protected:
VideoRenderer() {}
};
diff --git a/test/win/d3d_renderer.cc b/test/win/d3d_renderer.cc
index c0a65b5..18c6cd7 100644
--- a/test/win/d3d_renderer.cc
+++ b/test/win/d3d_renderer.cc
@@ -15,7 +15,7 @@
namespace webrtc {
namespace test {
-#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_TEX1)
+#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_TEX1)
struct D3dCustomVertex {
float x, y, z;
@@ -42,9 +42,13 @@
RTC_DCHECK_GT(height, 0);
}
-D3dRenderer::~D3dRenderer() { Destroy(); }
+D3dRenderer::~D3dRenderer() {
+ Destroy();
+}
-LRESULT WINAPI D3dRenderer::WindowProc(HWND hwnd, UINT msg, WPARAM wparam,
+LRESULT WINAPI D3dRenderer::WindowProc(HWND hwnd,
+ UINT msg,
+ WPARAM wparam,
LPARAM lparam) {
if (msg == WM_DESTROY || (msg == WM_CHAR && wparam == VK_RETURN)) {
PostQuitMessage(0);
@@ -68,17 +72,9 @@
}
bool D3dRenderer::Init(const char* window_title) {
- hwnd_ = CreateWindowA(kD3DClassName,
- window_title,
- WS_OVERLAPPEDWINDOW,
- 0,
- 0,
- static_cast<int>(width_),
- static_cast<int>(height_),
- NULL,
- NULL,
- NULL,
- NULL);
+ hwnd_ = CreateWindowA(kD3DClassName, window_title, WS_OVERLAPPEDWINDOW, 0, 0,
+ static_cast<int>(width_), static_cast<int>(height_),
+ NULL, NULL, NULL, NULL);
if (hwnd_ == NULL) {
Destroy();
@@ -97,11 +93,8 @@
d3d_params.SwapEffect = D3DSWAPEFFECT_COPY;
IDirect3DDevice9* d3d_device;
- if (d3d_->CreateDevice(D3DADAPTER_DEFAULT,
- D3DDEVTYPE_HAL,
- hwnd_,
- D3DCREATE_SOFTWARE_VERTEXPROCESSING,
- &d3d_params,
+ if (d3d_->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd_,
+ D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3d_params,
&d3d_device) != D3D_OK) {
Destroy();
return false;
@@ -112,11 +105,8 @@
IDirect3DVertexBuffer9* vertex_buffer;
const int kRectVertices = 4;
if (d3d_device_->CreateVertexBuffer(kRectVertices * sizeof(D3dCustomVertex),
- 0,
- D3DFVF_CUSTOMVERTEX,
- D3DPOOL_MANAGED,
- &vertex_buffer,
- NULL) != D3D_OK) {
+ 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED,
+ &vertex_buffer, NULL) != D3D_OK) {
Destroy();
return false;
}
@@ -166,22 +156,17 @@
IDirect3DTexture9* texture;
d3d_device_->CreateTexture(static_cast<UINT>(width_),
- static_cast<UINT>(height_),
- 1,
- 0,
- D3DFMT_A8R8G8B8,
- D3DPOOL_MANAGED,
- &texture,
- NULL);
+ static_cast<UINT>(height_), 1, 0, D3DFMT_A8R8G8B8,
+ D3DPOOL_MANAGED, &texture, NULL);
texture_ = texture;
texture->Release();
// Vertices for the video frame to be rendered to.
static const D3dCustomVertex rect[] = {
- {-1.0f, -1.0f, 0.0f, 0.0f, 1.0f},
- {-1.0f, 1.0f, 0.0f, 0.0f, 0.0f},
- {1.0f, -1.0f, 0.0f, 1.0f, 1.0f},
- {1.0f, 1.0f, 0.0f, 1.0f, 0.0f},
+ {-1.0f, -1.0f, 0.0f, 0.0f, 1.0f},
+ {-1.0f, 1.0f, 0.0f, 0.0f, 0.0f},
+ {1.0f, -1.0f, 0.0f, 1.0f, 1.0f},
+ {1.0f, 1.0f, 0.0f, 1.0f, 0.0f},
};
void* buf_data;
diff --git a/test/win/d3d_renderer.h b/test/win/d3d_renderer.h
index 68a5a80..7f25aba 100644
--- a/test/win/d3d_renderer.h
+++ b/test/win/d3d_renderer.h
@@ -12,7 +12,7 @@
#include <Windows.h>
#include <d3d9.h>
-#pragma comment(lib, "d3d9.lib") // located in DirectX SDK
+#pragma comment(lib, "d3d9.lib") // located in DirectX SDK
#include "rtc_base/scoped_ref_ptr.h"
#include "test/video_renderer.h"
@@ -23,7 +23,8 @@
class D3dRenderer : public VideoRenderer {
public:
- static D3dRenderer* Create(const char* window_title, size_t width,
+ static D3dRenderer* Create(const char* window_title,
+ size_t width,
size_t height);
virtual ~D3dRenderer();
@@ -32,7 +33,9 @@
private:
D3dRenderer(size_t width, size_t height);
- static LRESULT WINAPI WindowProc(HWND hwnd, UINT msg, WPARAM wparam,
+ static LRESULT WINAPI WindowProc(HWND hwnd,
+ UINT msg,
+ WPARAM wparam,
LPARAM lparam);
bool Init(const char* window_title);
void Resize(size_t width, size_t height);
diff --git a/test/win/run_loop_win.cc b/test/win/run_loop_win.cc
index 494adc4..28dc933 100644
--- a/test/win/run_loop_win.cc
+++ b/test/win/run_loop_win.cc
@@ -11,9 +11,9 @@
#include <assert.h>
+#include <Windows.h>
#include <conio.h>
#include <stdio.h>
-#include <Windows.h>
namespace webrtc {
namespace test {