Skip to content

Commit

Permalink
Enable clang::find_bad_constructs for sdk/ (part 1).
Browse files Browse the repository at this point in the history
This CL removes //build/config/clang:find_bad_constructs from the
suppressed_configs list, which means that clang:find_bad_constructs
is now enabled on these translation units.

Bug: webrtc:9251, webrtc:163
Change-Id: I6f03c46e772ccf4d15951a4b9d4e12015d539e58
Reviewed-on: https://webrtc-review.googlesource.com/90408
Reviewed-by: Fredrik Solenberg <[email protected]>
Reviewed-by: Kári Helgason <[email protected]>
Commit-Queue: Mirko Bonadei <[email protected]>
Cr-Commit-Position: refs/heads/master@{#24113}
  • Loading branch information
MirkoBonadei authored and Commit Bot committed Jul 26, 2018
1 parent a15fd0d commit 17aff35
Show file tree
Hide file tree
Showing 21 changed files with 97 additions and 164 deletions.
1 change: 1 addition & 0 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ if (rtc_include_tests) {
"base/fakertp.h",
"base/fakevideocapturer.cc",
"base/fakevideocapturer.h",
"base/fakevideorenderer.cc",
"base/fakevideorenderer.h",
"base/testutils.cc",
"base/testutils.h",
Expand Down
33 changes: 33 additions & 0 deletions media/base/fakevideorenderer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018 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 "media/base/fakevideorenderer.h"

namespace cricket {

FakeVideoRenderer::FakeVideoRenderer() = default;

void FakeVideoRenderer::OnFrame(const webrtc::VideoFrame& frame) {
rtc::CritScope cs(&crit_);
// TODO(zhurunz) Check with VP8 team to see if we can remove this
// tolerance on Y values. Some unit tests produce Y values close
// to 16 rather than close to zero, for supposedly black frames.
// Largest value observed is 34, e.g., running
// PeerConnectionIntegrationTest.SendAndReceive16To9AspectRatio.
black_frame_ = CheckFrameColorYuv(0, 48, 128, 128, 128, 128, &frame);
// Treat unexpected frame size as error.
++num_rendered_frames_;
width_ = frame.width();
height_ = frame.height();
rotation_ = frame.rotation();
timestamp_us_ = frame.timestamp_us();
}

} // namespace cricket
39 changes: 9 additions & 30 deletions media/base/fakevideorenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,9 @@ namespace cricket {
// Faked video renderer that has a callback for actions on rendering.
class FakeVideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
public:
FakeVideoRenderer()
: errors_(0),
width_(0),
height_(0),
rotation_(webrtc::kVideoRotation_0),
timestamp_us_(0),
num_rendered_frames_(0),
black_frame_(false) {}
FakeVideoRenderer();

virtual void OnFrame(const webrtc::VideoFrame& frame) {
rtc::CritScope cs(&crit_);
// TODO(zhurunz) Check with VP8 team to see if we can remove this
// tolerance on Y values. Some unit tests produce Y values close
// to 16 rather than close to zero, for supposedly black frames.
// Largest value observed is 34, e.g., running
// PeerConnectionIntegrationTest.SendAndReceive16To9AspectRatio.
black_frame_ = CheckFrameColorYuv(0, 48, 128, 128, 128, 128, &frame);
// Treat unexpected frame size as error.
++num_rendered_frames_;
width_ = frame.width();
height_ = frame.height();
rotation_ = frame.rotation();
timestamp_us_ = frame.timestamp_us();
}
void OnFrame(const webrtc::VideoFrame& frame) override;

int errors() const { return errors_; }
int width() const {
Expand Down Expand Up @@ -127,13 +106,13 @@ class FakeVideoRenderer : public rtc::VideoSinkInterface<webrtc::VideoFrame> {
return true;
}

int errors_;
int width_;
int height_;
webrtc::VideoRotation rotation_;
int64_t timestamp_us_;
int num_rendered_frames_;
bool black_frame_;
int errors_ = 0;
int width_ = 0;
int height_ = 0;
webrtc::VideoRotation rotation_ = webrtc::kVideoRotation_0;
int64_t timestamp_us_ = 0;
int num_rendered_frames_ = 0;
bool black_frame_ = false;
rtc::CriticalSection crit_;
};

Expand Down
98 changes: 0 additions & 98 deletions sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,6 @@ if (is_ios || is_mac) {
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
]

if (is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}

Expand Down Expand Up @@ -234,11 +228,6 @@ if (is_ios || is_mac) {
"..:common_objc",
":used_from_extension",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}

rtc_static_library("videoframebuffer_objc") {
Expand Down Expand Up @@ -316,11 +305,6 @@ if (is_ios || is_mac) {
"..:common_objc",
":used_from_extension",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}

rtc_static_library("ui_objc") {
Expand Down Expand Up @@ -442,12 +426,6 @@ if (is_ios || is_mac) {

public_configs = [ ":common_config_objc" ]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

deps = [
":common_objc",
":video_objc",
Expand Down Expand Up @@ -519,12 +497,6 @@ if (is_ios || is_mac) {
"objc/Framework/Headers/WebRTC/RTCVideoEncoderVP8.h",
]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

deps = [
":wrapped_native_codec_objc",
"../modules/video_coding:webrtc_vp8",
Expand All @@ -541,12 +513,6 @@ if (is_ios || is_mac) {
"objc/Framework/Headers/WebRTC/RTCVideoEncoderVP9.h",
]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

deps = [
":wrapped_native_codec_objc",
"../modules/video_coding:webrtc_vp9",
Expand Down Expand Up @@ -575,12 +541,6 @@ if (is_ios || is_mac) {

public_configs = [ ":common_config_objc" ]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

deps = [
":native_api",
":native_video",
Expand All @@ -596,11 +556,6 @@ if (is_ios || is_mac) {
"objc/Framework/Classes/PeerConnection/RTCMediaConstraints.mm",
"objc/Framework/Headers/WebRTC/RTCMediaConstraints.h",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

public_configs = [ ":common_config_objc" ]
deps = [
Expand Down Expand Up @@ -771,12 +726,6 @@ if (is_ios || is_mac) {
]
public_configs = [ ":common_config_objc" ]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

deps = [
":common_objc",
":mediaconstraints_objc",
Expand Down Expand Up @@ -879,12 +828,6 @@ if (is_ios || is_mac) {
]

include_dirs += [ "$root_out_dir/WebRTC.framework/Headers/" ]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}

bundle_data("sdk_unittests_bundle_data") {
Expand Down Expand Up @@ -915,12 +858,6 @@ if (is_ios || is_mac) {
":sdk_unittests_sources",
]
ldflags = [ "-all_load" ]

if (is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}

Expand Down Expand Up @@ -986,12 +923,6 @@ if (is_ios || is_mac) {
sources += [ "objc/Framework/UnitTests/RTCAudioSessionTest.mm" ]
deps += [ ":audio_objc" ]
}

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}

Expand Down Expand Up @@ -1111,12 +1042,6 @@ if (is_ios || is_mac) {
]

public_configs = [ ":common_config_objc" ]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
}
}

Expand All @@ -1131,12 +1056,6 @@ if (is_ios || is_mac) {
configs += [ "..:common_objc" ]
public_configs = [ ":common_config_objc" ]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

deps = [
":common_objc",
":videocodec_objc",
Expand Down Expand Up @@ -1171,12 +1090,6 @@ if (is_ios || is_mac) {

public_configs = [ ":common_config_objc" ]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}

deps = [
":native_video",
":videocapturebase_objc",
Expand Down Expand Up @@ -1254,11 +1167,6 @@ if (is_ios || is_mac) {
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}

rtc_static_library("videotoolbox_objc") {
Expand Down Expand Up @@ -1309,12 +1217,6 @@ if (is_ios || is_mac) {
"CoreVideo.framework",
"VideoToolbox.framework",
]

if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin
# (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ namespace webrtc {

class MediaConstraints : public MediaConstraintsInterface {
public:
virtual ~MediaConstraints();
~MediaConstraints() override;
MediaConstraints();
MediaConstraints(const MediaConstraintsInterface::Constraints& mandatory,
const MediaConstraintsInterface::Constraints& optional);
virtual const Constraints& GetMandatory() const;
virtual const Constraints& GetOptional() const;
const Constraints& GetMandatory() const override;
const Constraints& GetOptional() const override;

private:
MediaConstraintsInterface::Constraints mandatory_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace webrtc {
class PeerConnectionDelegateAdapter : public PeerConnectionObserver {
public:
PeerConnectionDelegateAdapter(RTCPeerConnection *peerConnection);
virtual ~PeerConnectionDelegateAdapter();
~PeerConnectionDelegateAdapter() override;

void OnSignalingChange(PeerConnectionInterface::SignalingState new_state) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
completion_handler_ = completionHandler;
}

~StatsObserverAdapter() {
completion_handler_ = nil;
}
~StatsObserverAdapter() override { completion_handler_ = nil; }

void OnComplete(const StatsReports& reports) override {
RTC_DCHECK(completion_handler_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@
completion_handler_ = completionHandler;
}

~CreateSessionDescriptionObserverAdapter() {
completion_handler_ = nil;
}
~CreateSessionDescriptionObserverAdapter() override { completion_handler_ = nil; }

void OnSuccess(SessionDescriptionInterface *desc) override {
RTC_DCHECK(completion_handler_);
Expand Down Expand Up @@ -86,9 +84,7 @@ void OnFailure(RTCError error) override {
completion_handler_ = completionHandler;
}

~SetSessionDescriptionObserverAdapter() {
completion_handler_ = nil;
}
~SetSessionDescriptionObserverAdapter() override { completion_handler_ = nil; }

void OnSuccess() override {
RTC_DCHECK(completion_handler_);
Expand Down
2 changes: 2 additions & 0 deletions sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ AnnexBBufferReader::AnnexBBufferReader(const uint8_t* annexb_buffer,
offset_ = offsets_.begin();
}

AnnexBBufferReader::~AnnexBBufferReader() = default;

bool AnnexBBufferReader::ReadNalu(const uint8_t** out_nalu,
size_t* out_length) {
RTC_DCHECK(out_nalu);
Expand Down
2 changes: 1 addition & 1 deletion sdk/objc/Framework/Classes/VideoToolbox/nalu_rewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ CMVideoFormatDescriptionRef CreateVideoFormatDescription(
class AnnexBBufferReader final {
public:
AnnexBBufferReader(const uint8_t* annexb_buffer, size_t length);
~AnnexBBufferReader() {}
~AnnexBBufferReader();
AnnexBBufferReader(const AnnexBBufferReader& other) = delete;
void operator=(const AnnexBBufferReader& other) = delete;

Expand Down
Loading

0 comments on commit 17aff35

Please sign in to comment.