Skip to content

Commit

Permalink
Enable clang::find_bad_constructs for audio_coding (part 1/2).
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: I6a7d4964723a5e195189aac30a83d9e924e61dd7
Reviewed-on: https://webrtc-review.googlesource.com/89743
Reviewed-by: Oskar Sundbom <[email protected]>
Commit-Queue: Mirko Bonadei <[email protected]>
Cr-Commit-Position: refs/heads/master@{#24053}
  • Loading branch information
MirkoBonadei authored and Commit Bot committed Jul 20, 2018
1 parent 5e6dcb2 commit 682aac5
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 49 deletions.
54 changes: 15 additions & 39 deletions modules/audio_coding/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1119,11 +1119,6 @@ rtc_source_set("neteq_tools_minimal") {
"neteq/tools/packet_source.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 = [
":neteq",
"../..:typedefs",
Expand Down Expand Up @@ -1510,31 +1505,22 @@ if (rtc_include_tests) {
"neteq/audio_decoder_unittest.cc",
]

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 = [
"../../test:fileutils",
]

defines = neteq_defines

deps += audio_coding_deps
deps += [
":ilbc",
":isac",
":isac_fix",
":neteq",
":neteq_tools",
"../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs/opus:audio_encoder_opus",
"../../common_audio",
"../../rtc_base:protobuf_utils",
"../../test:test_main",
"//testing/gtest",
]
deps = [
":ilbc",
":isac",
":isac_fix",
":neteq",
":neteq_tools",
"../../test:fileutils",
"../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs/opus:audio_encoder_opus",
"../../common_audio",
"../../rtc_base:protobuf_utils",
"../../test:test_main",
"//testing/gtest",
] + audio_coding_deps

data = audio_decoder_unittests_resources

Expand All @@ -1545,7 +1531,7 @@ if (rtc_include_tests) {
if (is_ios) {
deps += [ ":audio_decoder_unittests_bundle_data" ]
}
} # audio_decoder_unittests
}

if (rtc_enable_protobuf) {
proto_library("neteq_unittest_proto") {
Expand Down Expand Up @@ -1777,11 +1763,6 @@ if (rtc_include_tests) {
"../../system_wrappers:system_wrappers_default",
"//testing/gtest",
]

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_executable("neteq_opus_quality_test") {
Expand Down Expand Up @@ -2020,11 +2001,6 @@ if (rtc_include_tests) {
"../../test:test_main",
"//testing/gtest",
]

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_source_set("audio_coding_unittests") {
Expand Down
4 changes: 2 additions & 2 deletions modules/audio_coding/codecs/opus/opus_fec_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class OpusFecTest : public TestWithParam<coding_param> {
protected:
OpusFecTest();

virtual void SetUp();
virtual void TearDown();
void SetUp() override;
void TearDown() override;

virtual void EncodeABlock();

Expand Down
6 changes: 3 additions & 3 deletions modules/audio_coding/neteq/audio_decoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ class AudioDecoderTest : public ::testing::Test {
payload_type_(17),
decoder_(NULL) {}

virtual ~AudioDecoderTest() {}
~AudioDecoderTest() override {}

virtual void SetUp() {
void SetUp() override {
if (audio_encoder_)
codec_input_rate_hz_ = audio_encoder_->SampleRateHz();
// Create arrays.
ASSERT_GT(data_length_, 0u) << "The test must set data_length_ > 0";
}

virtual void TearDown() {
void TearDown() override {
delete decoder_;
decoder_ = NULL;
}
Expand Down
6 changes: 6 additions & 0 deletions modules/audio_coding/neteq/tools/encode_neteq_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ EncodeNetEqInput::EncodeNetEqInput(std::unique_ptr<Generator> generator,
CreatePacket();
}

EncodeNetEqInput::~EncodeNetEqInput() = default;

absl::optional<int64_t> EncodeNetEqInput::NextPacketTime() const {
RTC_DCHECK(packet_data_);
return static_cast<int64_t>(packet_data_->time_ms);
Expand All @@ -50,6 +52,10 @@ void EncodeNetEqInput::AdvanceOutputEvent() {
next_output_event_ms_ += kOutputPeriodMs;
}

bool EncodeNetEqInput::ended() const {
return next_output_event_ms_ <= input_duration_ms_;
}

absl::optional<RTPHeader> EncodeNetEqInput::NextHeader() const {
RTC_DCHECK(packet_data_);
return packet_data_->header;
Expand Down
5 changes: 2 additions & 3 deletions modules/audio_coding/neteq/tools/encode_neteq_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class EncodeNetEqInput : public NetEqInput {
EncodeNetEqInput(std::unique_ptr<Generator> generator,
std::unique_ptr<AudioEncoder> encoder,
int64_t input_duration_ms);
~EncodeNetEqInput() override;

absl::optional<int64_t> NextPacketTime() const override;

Expand All @@ -44,9 +45,7 @@ class EncodeNetEqInput : public NetEqInput {

void AdvanceOutputEvent() override;

bool ended() const override {
return next_output_event_ms_ <= input_duration_ms_;
}
bool ended() const override;

absl::optional<RTPHeader> NextHeader() const override;

Expand Down
5 changes: 5 additions & 0 deletions modules/audio_coding/neteq/tools/neteq_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
namespace webrtc {
namespace test {

NetEqInput::PacketData::PacketData() = default;
NetEqInput::PacketData::~PacketData() = default;

std::string NetEqInput::PacketData::ToString() const {
std::stringstream ss;
ss << "{"
Expand All @@ -34,6 +37,8 @@ TimeLimitedNetEqInput::TimeLimitedNetEqInput(std::unique_ptr<NetEqInput> input,
start_time_ms_(input_->NextEventTime()),
duration_ms_(duration_ms) {}

TimeLimitedNetEqInput::~TimeLimitedNetEqInput() = default;

absl::optional<int64_t> TimeLimitedNetEqInput::NextPacketTime() const {
return ended_ ? absl::nullopt : input_->NextPacketTime();
}
Expand Down
3 changes: 3 additions & 0 deletions modules/audio_coding/neteq/tools/neteq_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ namespace test {
class NetEqInput {
public:
struct PacketData {
PacketData();
~PacketData();
std::string ToString() const;

RTPHeader header;
Expand Down Expand Up @@ -84,6 +86,7 @@ class NetEqInput {
class TimeLimitedNetEqInput : public NetEqInput {
public:
TimeLimitedNetEqInput(std::unique_ptr<NetEqInput> input, int64_t duration_ms);
~TimeLimitedNetEqInput() override;
absl::optional<int64_t> NextPacketTime() const override;
absl::optional<int64_t> NextOutputEventTime() const override;
std::unique_ptr<PacketData> PopPacket() override;
Expand Down
2 changes: 2 additions & 0 deletions modules/audio_coding/neteq/tools/neteq_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ NetEqTest::NetEqTest(const NetEq::Config& config,
RegisterExternalDecoders(ext_codecs);
}

NetEqTest::~NetEqTest() = default;

int64_t NetEqTest::Run() {
const int64_t start_time_ms = *input_->NextEventTime();
int64_t time_now_ms = start_time_ms;
Expand Down
2 changes: 1 addition & 1 deletion modules/audio_coding/neteq/tools/neteq_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class NetEqTest {
std::unique_ptr<AudioSink> output,
Callbacks callbacks);

~NetEqTest() = default;
~NetEqTest();

// Runs the test. Returns the duration of the produced audio in ms.
int64_t Run();
Expand Down
2 changes: 1 addition & 1 deletion modules/audio_coding/neteq/tools/rtp_file_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RtpFileSource : public PacketSource {
static bool ValidRtpDump(const std::string& file_name);
static bool ValidPcap(const std::string& file_name);

virtual ~RtpFileSource();
~RtpFileSource() override;

// Registers an RTP header extension and binds it to |id|.
virtual bool RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id);
Expand Down

0 comments on commit 682aac5

Please sign in to comment.