diff options
author | jbauch <jbauch@webrtc.org> | 2015-12-10 03:11:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-10 11:11:48 +0000 |
commit | 0f2e939a92fc1a70a67a9fc141d1f1d006bcded9 (patch) | |
tree | 5669e8c779af2de5301a6037362263711047995d | |
parent | 162abd3562d7b08ab36569800d757b52739b9249 (diff) | |
download | webrtc-0f2e939a92fc1a70a67a9fc141d1f1d006bcded9.tar.gz |
Enable cpplint for more webrtc subfolders and fix all uncovered cpplint errors.
This CL enableds cpplint for webrtc/common_video, webrtc/sound and webrtc/tools.
BUG=webrtc:5273
TESTED=Fixed issues reported by:
find webrtc/common_video webrtc/sound webrtc/tools -type f -name *.cc -o -name *.h | xargs cpplint.py
followed by 'git cl presubmit'.
Review URL: https://codereview.webrtc.org/1511603004
Cr-Commit-Position: refs/heads/master@{#10967}
-rwxr-xr-x | PRESUBMIT.py | 3 | ||||
-rw-r--r-- | webrtc/common_video/i420_video_frame_unittest.cc | 5 | ||||
-rw-r--r-- | webrtc/common_video/libyuv/include/webrtc_libyuv.h | 3 | ||||
-rw-r--r-- | webrtc/common_video/libyuv/libyuv_unittest.cc | 34 | ||||
-rw-r--r-- | webrtc/common_video/libyuv/scaler_unittest.cc | 4 | ||||
-rw-r--r-- | webrtc/common_video/libyuv/webrtc_libyuv.cc | 12 | ||||
-rw-r--r-- | webrtc/common_video/video_render_frames.cc | 2 | ||||
-rw-r--r-- | webrtc/sound/alsasoundsystem.cc | 11 | ||||
-rw-r--r-- | webrtc/sound/pulseaudiosoundsystem.cc | 37 | ||||
-rw-r--r-- | webrtc/sound/soundinputstreaminterface.h | 2 | ||||
-rw-r--r-- | webrtc/tools/agc/activity_metric.cc | 2 | ||||
-rw-r--r-- | webrtc/tools/frame_analyzer/video_quality_analysis.cc | 2 | ||||
-rw-r--r-- | webrtc/tools/frame_editing/frame_editing_lib.cc | 1 | ||||
-rw-r--r-- | webrtc/tools/frame_editing/frame_editing_lib.h | 6 | ||||
-rw-r--r-- | webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc | 6 |
15 files changed, 66 insertions, 64 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 9747d9160b..cd356ca830 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -18,8 +18,11 @@ import sys CPPLINT_DIRS = [ 'webrtc/audio', 'webrtc/call', + 'webrtc/common_video', 'webrtc/examples', 'webrtc/modules/video_processing', + 'webrtc/sound', + 'webrtc/tools', 'webrtc/video', ] diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc index da3996b9bd..e1b103f118 100644 --- a/webrtc/common_video/i420_video_frame_unittest.cc +++ b/webrtc/common_video/i420_video_frame_unittest.cc @@ -8,8 +8,6 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "webrtc/video_frame.h" - #include <math.h> #include <string.h> @@ -17,6 +15,7 @@ #include "webrtc/base/bind.h" #include "webrtc/base/scoped_ptr.h" #include "webrtc/test/fake_texture_frame.h" +#include "webrtc/video_frame.h" namespace webrtc { @@ -174,7 +173,7 @@ TEST(TestVideoFrame, ShallowCopy) { TEST(TestVideoFrame, Reset) { VideoFrame frame; - ASSERT_TRUE(frame.CreateEmptyFrame(5, 5, 5, 5, 5) == 0); + ASSERT_EQ(frame.CreateEmptyFrame(5, 5, 5, 5, 5), 0); frame.set_ntp_time_ms(1); frame.set_timestamp(2); frame.set_render_time_ms(3); diff --git a/webrtc/common_video/libyuv/include/webrtc_libyuv.h b/webrtc/common_video/libyuv/include/webrtc_libyuv.h index baf8c171ad..d66736fb24 100644 --- a/webrtc/common_video/libyuv/include/webrtc_libyuv.h +++ b/webrtc/common_video/libyuv/include/webrtc_libyuv.h @@ -152,6 +152,7 @@ int ConvertNV12ToRGB565(const uint8_t* src_frame, double I420PSNR(const VideoFrame* ref_frame, const VideoFrame* test_frame); // Compute SSIM for an I420 frame (all planes). double I420SSIM(const VideoFrame* ref_frame, const VideoFrame* test_frame); -} + +} // namespace webrtc #endif // WEBRTC_COMMON_VIDEO_LIBYUV_INCLUDE_WEBRTC_LIBYUV_H_ diff --git a/webrtc/common_video/libyuv/libyuv_unittest.cc b/webrtc/common_video/libyuv/libyuv_unittest.cc index b674b51b67..e7cf0759f6 100644 --- a/webrtc/common_video/libyuv/libyuv_unittest.cc +++ b/webrtc/common_video/libyuv/libyuv_unittest.cc @@ -97,7 +97,7 @@ TestLibYuv::TestLibYuv() width_(352), height_(288), size_y_(width_ * height_), - size_uv_(((width_ + 1 ) / 2) * ((height_ + 1) / 2)), + size_uv_(((width_ + 1) / 2) * ((height_ + 1) / 2)), frame_length_(CalcBufferSize(kI420, 352, 288)) { orig_buffer_.reset(new uint8_t[frame_length_]); } @@ -142,9 +142,9 @@ TEST_F(TestLibYuv, ConvertTest) { double psnr = 0.0; VideoFrame res_i420_frame; - EXPECT_EQ(0,res_i420_frame.CreateEmptyFrame(width_, height_, width_, - (width_ + 1) / 2, - (width_ + 1) / 2)); + EXPECT_EQ(0, res_i420_frame.CreateEmptyFrame(width_, height_, width_, + (width_ + 1) / 2, + (width_ + 1) / 2)); printf("\nConvert #%d I420 <-> I420 \n", j); rtc::scoped_ptr<uint8_t[]> out_i420_buffer(new uint8_t[frame_length_]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kI420, 0, @@ -281,8 +281,8 @@ TEST_F(TestLibYuv, ConvertAlignedFrame) { int stride_y = 0; int stride_uv = 0; Calc16ByteAlignedStride(width_, &stride_y, &stride_uv); - EXPECT_EQ(0,res_i420_frame.CreateEmptyFrame(width_, height_, - stride_y, stride_uv, stride_uv)); + EXPECT_EQ(0, res_i420_frame.CreateEmptyFrame(width_, height_, + stride_y, stride_uv, stride_uv)); rtc::scoped_ptr<uint8_t[]> out_i420_buffer(new uint8_t[frame_length_]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kI420, 0, out_i420_buffer.get())); @@ -303,27 +303,27 @@ TEST_F(TestLibYuv, RotateTest) { VideoFrame rotated_res_i420_frame; int rotated_width = height_; int rotated_height = width_; - int stride_y ; + int stride_y; int stride_uv; Calc16ByteAlignedStride(rotated_width, &stride_y, &stride_uv); - EXPECT_EQ(0,rotated_res_i420_frame.CreateEmptyFrame(rotated_width, - rotated_height, - stride_y, - stride_uv, - stride_uv)); + EXPECT_EQ(0, rotated_res_i420_frame.CreateEmptyFrame(rotated_width, + rotated_height, + stride_y, + stride_uv, + stride_uv)); EXPECT_EQ(0, ConvertToI420(kI420, orig_buffer_.get(), 0, 0, width_, height_, 0, kVideoRotation_90, &rotated_res_i420_frame)); EXPECT_EQ(0, ConvertToI420(kI420, orig_buffer_.get(), 0, 0, width_, height_, 0, kVideoRotation_270, &rotated_res_i420_frame)); - EXPECT_EQ(0,rotated_res_i420_frame.CreateEmptyFrame(width_, height_, - width_, (width_ + 1) / 2, - (width_ + 1) / 2)); + EXPECT_EQ(0, rotated_res_i420_frame.CreateEmptyFrame(width_, height_, + width_, (width_ + 1) / 2, + (width_ + 1) / 2)); EXPECT_EQ(0, ConvertToI420(kI420, orig_buffer_.get(), 0, 0, width_, height_, 0, kVideoRotation_180, &rotated_res_i420_frame)); } TEST_F(TestLibYuv, alignment) { - int value = 0x3FF; // 1023 + int value = 0x3FF; // 1023 EXPECT_EQ(0x400, AlignInt(value, 128)); // Low 7 bits are zero. EXPECT_EQ(0x400, AlignInt(value, 64)); // Low 6 bits are zero. EXPECT_EQ(0x400, AlignInt(value, 32)); // Low 5 bits are zero. @@ -346,4 +346,4 @@ TEST_F(TestLibYuv, StrideAlignment) { EXPECT_EQ(64, stride_uv); } -} // namespace +} // namespace webrtc diff --git a/webrtc/common_video/libyuv/scaler_unittest.cc b/webrtc/common_video/libyuv/scaler_unittest.cc index 568311bc2e..526e62cb3c 100644 --- a/webrtc/common_video/libyuv/scaler_unittest.cc +++ b/webrtc/common_video/libyuv/scaler_unittest.cc @@ -114,7 +114,7 @@ TEST_F(TestScaler, ScaleSendingBufferTooSmall) { EXPECT_EQ(half_height_, test_frame2.height()); } -//TODO (mikhal): Converge the test into one function that accepts the method. +// TODO(mikhal): Converge the test into one function that accepts the method. TEST_F(TestScaler, DISABLED_ON_ANDROID(PointScaleTest)) { double avg_psnr; FILE* source_file2; @@ -322,7 +322,7 @@ double TestScaler::ComputeAvgSequencePSNR(FILE* input_file, return avg_psnr; } -// TODO (mikhal): Move part to a separate scale test. +// TODO(mikhal): Move part to a separate scale test. void TestScaler::ScaleSequence(ScaleMethod method, FILE* source_file, std::string out_name, int src_width, int src_height, diff --git a/webrtc/common_video/libyuv/webrtc_libyuv.cc b/webrtc/common_video/libyuv/webrtc_libyuv.cc index bf95624769..48f5c2036b 100644 --- a/webrtc/common_video/libyuv/webrtc_libyuv.cc +++ b/webrtc/common_video/libyuv/webrtc_libyuv.cc @@ -58,7 +58,7 @@ VideoType RawVideoTypeToCommonVideoVideoType(RawVideoType type) { int AlignInt(int value, int alignment) { assert(!((alignment - 1) & alignment)); - return ((value + alignment - 1) & ~ (alignment - 1)); + return ((value + alignment - 1) & ~(alignment - 1)); } void Calc16ByteAlignedStride(int width, int* stride_y, int* stride_uv) { @@ -119,8 +119,8 @@ int PrintVideoFrame(const VideoFrame& frame, FILE* file) { } plane_buffer += frame.stride(plane_type); } - } - return 0; + } + return 0; } int ExtractBuffer(const VideoFrame& input_frame, size_t size, uint8_t* buffer) { @@ -176,7 +176,7 @@ int ConvertRGB24ToARGB(const uint8_t* src_frame, uint8_t* dst_frame, } libyuv::RotationMode ConvertRotationMode(VideoRotation rotation) { - switch(rotation) { + switch (rotation) { case kVideoRotation_0: return libyuv::kRotate0; case kVideoRotation_90: @@ -191,7 +191,7 @@ libyuv::RotationMode ConvertRotationMode(VideoRotation rotation) { } int ConvertVideoType(VideoType video_type) { - switch(video_type) { + switch (video_type) { case kUnknown: return libyuv::FOURCC_ANY; case kI420: @@ -243,7 +243,7 @@ int ConvertToI420(VideoType src_video_type, // Stride values should correspond to the destination values. if (rotation == kVideoRotation_90 || rotation == kVideoRotation_270) { dst_width = dst_frame->height(); - dst_height =dst_frame->width(); + dst_height = dst_frame->width(); } return libyuv::ConvertToI420(src_frame, sample_size, dst_frame->buffer(kYPlane), diff --git a/webrtc/common_video/video_render_frames.cc b/webrtc/common_video/video_render_frames.cc index a7db15c7ea..8b447cb10f 100644 --- a/webrtc/common_video/video_render_frames.cc +++ b/webrtc/common_video/video_render_frames.cc @@ -20,7 +20,7 @@ namespace webrtc { const uint32_t KEventMaxWaitTimeMs = 200; const uint32_t kMinRenderDelayMs = 10; -const uint32_t kMaxRenderDelayMs= 500; +const uint32_t kMaxRenderDelayMs = 500; VideoRenderFrames::VideoRenderFrames() : render_delay_ms_(10) { diff --git a/webrtc/sound/alsasoundsystem.cc b/webrtc/sound/alsasoundsystem.cc index 3f97446e06..696ff1e450 100644 --- a/webrtc/sound/alsasoundsystem.cc +++ b/webrtc/sound/alsasoundsystem.cc @@ -11,6 +11,7 @@ #include "webrtc/sound/alsasoundsystem.h" #include <algorithm> +#include <string> #include "webrtc/base/arraysize.h" #include "webrtc/base/common.h" @@ -259,12 +260,12 @@ class AlsaInputStream : } bool GetVolume(int *volume) override { - // TODO: Implement this. + // TODO(henrika): Implement this. return false; } bool SetVolume(int volume) override { - // TODO: Implement this. + // TODO(henrika): Implement this. return false; } @@ -390,12 +391,12 @@ class AlsaOutputStream : public SoundOutputStreamInterface, } bool GetVolume(int *volume) override { - // TODO: Implement this. + // TODO(henrika): Implement this. return false; } bool SetVolume(int volume) override { - // TODO: Implement this. + // TODO(henrika): Implement this. return false; } @@ -569,7 +570,6 @@ bool AlsaSoundSystem::EnumerateDevices( strcmp(name, ignore_null) != 0 && strcmp(name, ignore_pulse) != 0 && !rtc::starts_with(name, ignore_prefix)) { - // Yes, we do. char *desc = symbol_table_.snd_device_name_get_hint()(*list, "DESC"); if (!desc) { @@ -622,7 +622,6 @@ StreamInterface *AlsaSoundSystem::OpenDevice( int wait_timeout_ms, int flags, int freq)) { - if (!IsInitialized()) { return NULL; } diff --git a/webrtc/sound/pulseaudiosoundsystem.cc b/webrtc/sound/pulseaudiosoundsystem.cc index b1845f5d07..15da76c583 100644 --- a/webrtc/sound/pulseaudiosoundsystem.cc +++ b/webrtc/sound/pulseaudiosoundsystem.cc @@ -13,6 +13,7 @@ #ifdef HAVE_LIBPULSE #include <algorithm> +#include <string> #include "webrtc/base/arraysize.h" #include "webrtc/base/common.h" @@ -216,17 +217,6 @@ class PulseAudioStream { class PulseAudioInputStream : public SoundInputStreamInterface, private rtc::Worker { - - struct GetVolumeCallbackData { - PulseAudioInputStream *instance; - pa_cvolume *channel_volumes; - }; - - struct GetSourceChannelCountCallbackData { - PulseAudioInputStream *instance; - uint8_t *channels; - }; - public: PulseAudioInputStream(PulseAudioSoundSystem *pulse, pa_stream *stream, @@ -386,6 +376,16 @@ class PulseAudioInputStream : } private: + struct GetVolumeCallbackData { + PulseAudioInputStream* instance; + pa_cvolume* channel_volumes; + }; + + struct GetSourceChannelCountCallbackData { + PulseAudioInputStream* instance; + uint8_t* channels; + }; + void Lock() { stream_.Lock(); } @@ -580,12 +580,6 @@ class PulseAudioInputStream : class PulseAudioOutputStream : public SoundOutputStreamInterface, private rtc::Worker { - - struct GetVolumeCallbackData { - PulseAudioOutputStream *instance; - pa_cvolume *channel_volumes; - }; - public: PulseAudioOutputStream(PulseAudioSoundSystem *pulse, pa_stream *stream, @@ -733,7 +727,7 @@ class PulseAudioOutputStream : } #if 0 - // TODO: Versions 0.9.16 and later of Pulse have a new API for + // TODO(henrika): Versions 0.9.16 and later of Pulse have a new API for // zero-copy writes, but Hardy is not new enough to have that so we can't // rely on it. Perhaps auto-detect if it's present or not and use it if we // can? @@ -777,6 +771,11 @@ class PulseAudioOutputStream : #endif private: + struct GetVolumeCallbackData { + PulseAudioOutputStream* instance; + pa_cvolume* channel_volumes; + }; + void Lock() { stream_.Lock(); } @@ -1165,7 +1164,7 @@ bool PulseAudioSoundSystem::ConnectToPulse(pa_context *context) { pa_context *PulseAudioSoundSystem::CreateNewConnection() { // Create connection context. std::string app_name; - // TODO: Pulse etiquette says this name should be localized. Do + // TODO(henrika): Pulse etiquette says this name should be localized. Do // we care? rtc::Filesystem::GetApplicationName(&app_name); pa_context *context = symbol_table_.pa_context_new()( diff --git a/webrtc/sound/soundinputstreaminterface.h b/webrtc/sound/soundinputstreaminterface.h index 2c934ba679..576ff71dd2 100644 --- a/webrtc/sound/soundinputstreaminterface.h +++ b/webrtc/sound/soundinputstreaminterface.h @@ -65,4 +65,4 @@ class SoundInputStreamInterface { } // namespace rtc -#endif // WEBRTC_SOUND_SOUNDOUTPUTSTREAMINTERFACE_H_ +#endif // WEBRTC_SOUND_SOUNDINPUTSTREAMINTERFACE_H_ diff --git a/webrtc/tools/agc/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc index 3f8235e641..55280fb0d5 100644 --- a/webrtc/tools/agc/activity_metric.cc +++ b/webrtc/tools/agc/activity_metric.cc @@ -65,7 +65,7 @@ static void DitherSilence(AudioFrame* frame) { sum_squared += frame->data_[n] * frame->data_[n]; if (sum_squared <= sum_squared_silence) { for (size_t n = 0; n < frame->samples_per_channel_; n++) - frame->data_[n] = (rand() & 0xF) - 8; + frame->data_[n] = (rand() & 0xF) - 8; // NOLINT: ignore non-threadsafe. } } diff --git a/webrtc/tools/frame_analyzer/video_quality_analysis.cc b/webrtc/tools/frame_analyzer/video_quality_analysis.cc index 172baa72b8..dfd57f1961 100644 --- a/webrtc/tools/frame_analyzer/video_quality_analysis.cc +++ b/webrtc/tools/frame_analyzer/video_quality_analysis.cc @@ -227,7 +227,7 @@ void RunAnalysis(const char* reference_file_name, const char* test_file_name, ResultsContainer* results) { // Check if the reference_file_name ends with "y4m". bool y4m_mode = false; - if (std::string(reference_file_name).find("y4m") != std::string::npos){ + if (std::string(reference_file_name).find("y4m") != std::string::npos) { y4m_mode = true; } diff --git a/webrtc/tools/frame_editing/frame_editing_lib.cc b/webrtc/tools/frame_editing/frame_editing_lib.cc index 79c6033a30..90855a354c 100644 --- a/webrtc/tools/frame_editing/frame_editing_lib.cc +++ b/webrtc/tools/frame_editing/frame_editing_lib.cc @@ -15,6 +15,7 @@ #include "webrtc/base/scoped_ptr.h" #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" +#include "webrtc/tools/frame_editing/frame_editing_lib.h" #include "webrtc/typedefs.h" using std::string; diff --git a/webrtc/tools/frame_editing/frame_editing_lib.h b/webrtc/tools/frame_editing/frame_editing_lib.h index 245d60f376..94595c43bb 100644 --- a/webrtc/tools/frame_editing/frame_editing_lib.h +++ b/webrtc/tools/frame_editing/frame_editing_lib.h @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#ifndef WEBRTC_TOOLS_FRAME_EDITING_FRAME_EDITING_H_ -#define WEBRTC_TOOLS_FRAME_EDITING_FRAME_EDITING_H_ +#ifndef WEBRTC_TOOLS_FRAME_EDITING_FRAME_EDITING_LIB_H_ +#define WEBRTC_TOOLS_FRAME_EDITING_FRAME_EDITING_LIB_H_ #include <string> @@ -36,4 +36,4 @@ int EditFrames(const std::string& in_path, int width, int height, int last_frame_to_process, const std::string& out_path); } // namespace webrtc -#endif // WEBRTC_TOOLS_FRAME_EDITING_FRAME_EDITING_H_ +#endif // WEBRTC_TOOLS_FRAME_EDITING_FRAME_EDITING_LIB_H_ diff --git a/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc b/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc index bae145a78f..737661c3df 100644 --- a/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc +++ b/webrtc/tools/psnr_ssim_analyzer/psnr_ssim_analyzer.cc @@ -25,7 +25,7 @@ void CompareFiles(const char* reference_file_name, const char* test_file_name, const char* results_file_name, int width, int height) { // Check if the reference_file_name ends with "y4m". bool y4m_mode = false; - if (std::string(reference_file_name).find("y4m") != std::string::npos){ + if (std::string(reference_file_name).find("y4m") != std::string::npos) { y4m_mode = true; } @@ -38,8 +38,8 @@ void CompareFiles(const char* reference_file_name, const char* test_file_name, uint8_t* ref_frame = new uint8_t[size]; bool read_result = true; - for(int frame_counter = 0; frame_counter < MAX_NUM_FRAMES_PER_FILE; - ++frame_counter){ + for (int frame_counter = 0; frame_counter < MAX_NUM_FRAMES_PER_FILE; + ++frame_counter) { read_result &= (y4m_mode) ? webrtc::test::ExtractFrameFromY4mFile( reference_file_name, width, height, frame_counter, ref_frame): webrtc::test::ExtractFrameFromYuvFile(reference_file_name, width, |