Fix clang style errors in rtp_rtcp and dependant targets
Mark functions with override instead of virtual.
Add explicit non-trivial constructors/assign operators/destructors.
Define them in .cc files instead of inlining
use auto* instead of auto when deduced type is raw pointer
Bug: webrtc:163
Change-Id: I4d8a05d6a64fcc2ca16d02c5fcf9488fda832a6d
Reviewed-on: https://webrtc-review.googlesource.com/48781
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21927}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 41130f5..63bc99c 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -69,6 +69,7 @@
"rtp_headers.h",
"rtpparameters.cc",
"rtpparameters.h",
+ "rtpreceiverinterface.cc",
"rtpreceiverinterface.h",
"rtpsenderinterface.h",
"rtptransceiverinterface.h",
diff --git a/api/mediastreaminterface.cc b/api/mediastreaminterface.cc
index 0bc5d61..6f08a0c 100644
--- a/api/mediastreaminterface.cc
+++ b/api/mediastreaminterface.cc
@@ -45,4 +45,17 @@
return new_stats;
}
+VideoTrackInterface::ContentHint VideoTrackInterface::content_hint() const {
+ return ContentHint::kNone;
+}
+
+bool AudioTrackInterface::GetSignalLevel(int* level) {
+ return false;
+}
+
+rtc::scoped_refptr<AudioProcessorInterface>
+AudioTrackInterface::GetAudioProcessor() {
+ return nullptr;
+}
+
} // namespace webrtc
diff --git a/api/mediastreaminterface.h b/api/mediastreaminterface.h
index 3273c6d..b7ba332 100644
--- a/api/mediastreaminterface.h
+++ b/api/mediastreaminterface.h
@@ -72,7 +72,7 @@
virtual bool remote() const = 0;
protected:
- virtual ~MediaSourceInterface() {}
+ ~MediaSourceInterface() override = default;
};
// C++ version of MediaStreamTrack.
@@ -106,7 +106,7 @@
virtual TrackState state() const = 0;
protected:
- virtual ~MediaStreamTrackInterface() {}
+ ~MediaStreamTrackInterface() override = default;
};
// VideoTrackSourceInterface is a reference counted source used for
@@ -147,7 +147,7 @@
virtual bool GetStats(Stats* stats) = 0;
protected:
- virtual ~VideoTrackSourceInterface() {}
+ ~VideoTrackSourceInterface() override = default;
};
// VideoTrackInterface is designed to be invoked on the signaling thread except
@@ -173,11 +173,11 @@
virtual VideoTrackSourceInterface* GetSource() const = 0;
- virtual ContentHint content_hint() const { return ContentHint::kNone; }
+ virtual ContentHint content_hint() const;
virtual void set_content_hint(ContentHint hint) {}
protected:
- virtual ~VideoTrackInterface() {}
+ ~VideoTrackInterface() override = default;
};
// Interface for receiving audio data from a AudioTrack.
@@ -269,7 +269,7 @@
virtual AudioProcessorStatistics GetStats(bool has_remote_tracks);
protected:
- virtual ~AudioProcessorInterface() {}
+ ~AudioProcessorInterface() override = default;
};
class AudioTrackInterface : public MediaStreamTrackInterface {
@@ -286,17 +286,15 @@
// Return true on success, otherwise false.
// TODO(deadbeef): Change the interface to int GetSignalLevel() and pure
// virtual after it's implemented in chromium.
- virtual bool GetSignalLevel(int* level) { return false; }
+ virtual bool GetSignalLevel(int* level);
// Get the audio processor used by the audio track. Return null if the track
// does not have any processor.
// TODO(deadbeef): Make the interface pure virtual.
- virtual rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor() {
- return nullptr;
- }
+ virtual rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor();
protected:
- virtual ~AudioTrackInterface() {}
+ ~AudioTrackInterface() override = default;
};
typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> >
@@ -331,7 +329,7 @@
virtual bool RemoveTrack(VideoTrackInterface* track) = 0;
protected:
- virtual ~MediaStreamInterface() {}
+ ~MediaStreamInterface() override = default;
};
} // namespace webrtc
diff --git a/api/rtpreceiverinterface.cc b/api/rtpreceiverinterface.cc
new file mode 100644
index 0000000..b62f744
--- /dev/null
+++ b/api/rtpreceiverinterface.cc
@@ -0,0 +1,48 @@
+/*
+ * Copyright 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 "api/rtpreceiverinterface.h"
+
+namespace webrtc {
+
+RtpSource::RtpSource(int64_t timestamp_ms,
+ uint32_t source_id,
+ RtpSourceType source_type)
+ : timestamp_ms_(timestamp_ms),
+ source_id_(source_id),
+ source_type_(source_type) {}
+
+RtpSource::RtpSource(int64_t timestamp_ms,
+ uint32_t source_id,
+ RtpSourceType source_type,
+ uint8_t audio_level)
+ : timestamp_ms_(timestamp_ms),
+ source_id_(source_id),
+ source_type_(source_type),
+ audio_level_(audio_level) {}
+
+RtpSource::RtpSource(const RtpSource&) = default;
+RtpSource& RtpSource::operator=(const RtpSource&) = default;
+RtpSource::~RtpSource() = default;
+
+std::vector<rtc::scoped_refptr<MediaStreamInterface>>
+RtpReceiverInterface::streams() const {
+ return {};
+}
+
+std::vector<RtpSource> RtpReceiverInterface::GetSources() const {
+ return {};
+}
+
+int RtpReceiverInterface::AttachmentId() const {
+ return 0;
+}
+
+} // namespace webrtc
diff --git a/api/rtpreceiverinterface.h b/api/rtpreceiverinterface.h
index ac2e090..017c95a 100644
--- a/api/rtpreceiverinterface.h
+++ b/api/rtpreceiverinterface.h
@@ -34,19 +34,16 @@
class RtpSource {
public:
RtpSource() = delete;
- RtpSource(int64_t timestamp_ms, uint32_t source_id, RtpSourceType source_type)
- : timestamp_ms_(timestamp_ms),
- source_id_(source_id),
- source_type_(source_type) {}
-
+ RtpSource(int64_t timestamp_ms,
+ uint32_t source_id,
+ RtpSourceType source_type);
RtpSource(int64_t timestamp_ms,
uint32_t source_id,
RtpSourceType source_type,
- uint8_t audio_level)
- : timestamp_ms_(timestamp_ms),
- source_id_(source_id),
- source_type_(source_type),
- audio_level_(audio_level) {}
+ uint8_t audio_level);
+ RtpSource(const RtpSource&);
+ RtpSource& operator=(const RtpSource&);
+ ~RtpSource();
int64_t timestamp_ms() const { return timestamp_ms_; }
void update_timestamp_ms(int64_t timestamp_ms) {
@@ -98,10 +95,7 @@
// the [[AssociatedRemoteMediaStreams]] internal slot in the spec.
// https://w3c.github.io/webrtc-pc/#dfn-x%5B%5Bassociatedremotemediastreams%5D%5D
// TODO(hbos): Make pure virtual as soon as Chromium's mock implements this.
- virtual std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams()
- const {
- return std::vector<rtc::scoped_refptr<MediaStreamInterface>>();
- }
+ virtual std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams() const;
// Audio or video receiver?
virtual cricket::MediaType media_type() const = 0;
@@ -124,19 +118,18 @@
// TODO(zhihuang): Remove the default implementation once the subclasses
// implement this. Currently, the only relevant subclass is the
// content::FakeRtpReceiver in Chromium.
- virtual std::vector<RtpSource> GetSources() const {
- return std::vector<RtpSource>();
- }
+ virtual std::vector<RtpSource> GetSources() const;
+
// TODO(hta): Remove default implementation or move function to
// an internal interface. content::FakeRtpReceiver in Chromium needs this.
// Returns an ID that changes if the attached track changes, but
// otherwise remains constant. Used to generate IDs for stats.
// The special value zero means that no track is attached.
- virtual int AttachmentId() const { return 0; }
+ virtual int AttachmentId() const;
protected:
- virtual ~RtpReceiverInterface() {}
+ ~RtpReceiverInterface() override = default;
};
// Define proxy for RtpReceiverInterface.