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}
This commit is contained in:
Danil Chapovalov
2018-02-07 09:38:31 +01:00
committed by Commit Bot
parent 740f8e72df
commit 2a5ce2bcf8
43 changed files with 189 additions and 65 deletions

View File

@ -69,6 +69,7 @@ rtc_static_library("libjingle_peerconnection_api") {
"rtp_headers.h", "rtp_headers.h",
"rtpparameters.cc", "rtpparameters.cc",
"rtpparameters.h", "rtpparameters.h",
"rtpreceiverinterface.cc",
"rtpreceiverinterface.h", "rtpreceiverinterface.h",
"rtpsenderinterface.h", "rtpsenderinterface.h",
"rtptransceiverinterface.h", "rtptransceiverinterface.h",

View File

@ -45,4 +45,17 @@ AudioProcessorInterface::GetStats(bool /*has_remote_tracks*/) {
return new_stats; 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 } // namespace webrtc

View File

@ -72,7 +72,7 @@ class MediaSourceInterface : public rtc::RefCountInterface,
virtual bool remote() const = 0; virtual bool remote() const = 0;
protected: protected:
virtual ~MediaSourceInterface() {} ~MediaSourceInterface() override = default;
}; };
// C++ version of MediaStreamTrack. // C++ version of MediaStreamTrack.
@ -106,7 +106,7 @@ class MediaStreamTrackInterface : public rtc::RefCountInterface,
virtual TrackState state() const = 0; virtual TrackState state() const = 0;
protected: protected:
virtual ~MediaStreamTrackInterface() {} ~MediaStreamTrackInterface() override = default;
}; };
// VideoTrackSourceInterface is a reference counted source used for // VideoTrackSourceInterface is a reference counted source used for
@ -147,7 +147,7 @@ class VideoTrackSourceInterface
virtual bool GetStats(Stats* stats) = 0; virtual bool GetStats(Stats* stats) = 0;
protected: protected:
virtual ~VideoTrackSourceInterface() {} ~VideoTrackSourceInterface() override = default;
}; };
// VideoTrackInterface is designed to be invoked on the signaling thread except // VideoTrackInterface is designed to be invoked on the signaling thread except
@ -173,11 +173,11 @@ class VideoTrackInterface
virtual VideoTrackSourceInterface* GetSource() const = 0; 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) {} virtual void set_content_hint(ContentHint hint) {}
protected: protected:
virtual ~VideoTrackInterface() {} ~VideoTrackInterface() override = default;
}; };
// Interface for receiving audio data from a AudioTrack. // Interface for receiving audio data from a AudioTrack.
@ -269,7 +269,7 @@ class AudioProcessorInterface : public rtc::RefCountInterface {
virtual AudioProcessorStatistics GetStats(bool has_remote_tracks); virtual AudioProcessorStatistics GetStats(bool has_remote_tracks);
protected: protected:
virtual ~AudioProcessorInterface() {} ~AudioProcessorInterface() override = default;
}; };
class AudioTrackInterface : public MediaStreamTrackInterface { class AudioTrackInterface : public MediaStreamTrackInterface {
@ -286,17 +286,15 @@ class AudioTrackInterface : public MediaStreamTrackInterface {
// Return true on success, otherwise false. // Return true on success, otherwise false.
// TODO(deadbeef): Change the interface to int GetSignalLevel() and pure // TODO(deadbeef): Change the interface to int GetSignalLevel() and pure
// virtual after it's implemented in chromium. // 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 // Get the audio processor used by the audio track. Return null if the track
// does not have any processor. // does not have any processor.
// TODO(deadbeef): Make the interface pure virtual. // TODO(deadbeef): Make the interface pure virtual.
virtual rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor() { virtual rtc::scoped_refptr<AudioProcessorInterface> GetAudioProcessor();
return nullptr;
}
protected: protected:
virtual ~AudioTrackInterface() {} ~AudioTrackInterface() override = default;
}; };
typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> > typedef std::vector<rtc::scoped_refptr<AudioTrackInterface> >
@ -331,7 +329,7 @@ class MediaStreamInterface : public rtc::RefCountInterface,
virtual bool RemoveTrack(VideoTrackInterface* track) = 0; virtual bool RemoveTrack(VideoTrackInterface* track) = 0;
protected: protected:
virtual ~MediaStreamInterface() {} ~MediaStreamInterface() override = default;
}; };
} // namespace webrtc } // namespace webrtc

View File

@ -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

View File

@ -34,19 +34,16 @@ enum class RtpSourceType {
class RtpSource { class RtpSource {
public: public:
RtpSource() = delete; RtpSource() = delete;
RtpSource(int64_t timestamp_ms, uint32_t source_id, RtpSourceType source_type) RtpSource(int64_t timestamp_ms,
: timestamp_ms_(timestamp_ms), uint32_t source_id,
source_id_(source_id), RtpSourceType source_type);
source_type_(source_type) {}
RtpSource(int64_t timestamp_ms, RtpSource(int64_t timestamp_ms,
uint32_t source_id, uint32_t source_id,
RtpSourceType source_type, RtpSourceType source_type,
uint8_t audio_level) uint8_t audio_level);
: timestamp_ms_(timestamp_ms), RtpSource(const RtpSource&);
source_id_(source_id), RtpSource& operator=(const RtpSource&);
source_type_(source_type), ~RtpSource();
audio_level_(audio_level) {}
int64_t timestamp_ms() const { return timestamp_ms_; } int64_t timestamp_ms() const { return timestamp_ms_; }
void update_timestamp_ms(int64_t timestamp_ms) { void update_timestamp_ms(int64_t timestamp_ms) {
@ -98,10 +95,7 @@ class RtpReceiverInterface : public rtc::RefCountInterface {
// the [[AssociatedRemoteMediaStreams]] internal slot in the spec. // the [[AssociatedRemoteMediaStreams]] internal slot in the spec.
// https://w3c.github.io/webrtc-pc/#dfn-x%5B%5Bassociatedremotemediastreams%5D%5D // 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. // TODO(hbos): Make pure virtual as soon as Chromium's mock implements this.
virtual std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams() virtual std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams() const;
const {
return std::vector<rtc::scoped_refptr<MediaStreamInterface>>();
}
// Audio or video receiver? // Audio or video receiver?
virtual cricket::MediaType media_type() const = 0; virtual cricket::MediaType media_type() const = 0;
@ -124,19 +118,18 @@ class RtpReceiverInterface : public rtc::RefCountInterface {
// TODO(zhihuang): Remove the default implementation once the subclasses // TODO(zhihuang): Remove the default implementation once the subclasses
// implement this. Currently, the only relevant subclass is the // implement this. Currently, the only relevant subclass is the
// content::FakeRtpReceiver in Chromium. // content::FakeRtpReceiver in Chromium.
virtual std::vector<RtpSource> GetSources() const { virtual std::vector<RtpSource> GetSources() const;
return std::vector<RtpSource>();
}
// TODO(hta): Remove default implementation or move function to // TODO(hta): Remove default implementation or move function to
// an internal interface. content::FakeRtpReceiver in Chromium needs this. // an internal interface. content::FakeRtpReceiver in Chromium needs this.
// Returns an ID that changes if the attached track changes, but // Returns an ID that changes if the attached track changes, but
// otherwise remains constant. Used to generate IDs for stats. // otherwise remains constant. Used to generate IDs for stats.
// The special value zero means that no track is attached. // The special value zero means that no track is attached.
virtual int AttachmentId() const { return 0; } virtual int AttachmentId() const;
protected: protected:
virtual ~RtpReceiverInterface() {} ~RtpReceiverInterface() override = default;
}; };
// Define proxy for RtpReceiverInterface. // Define proxy for RtpReceiverInterface.

View File

@ -26,6 +26,8 @@ typedef rtc::Optional<webrtc::SpsParser::SpsState> OptionalSps;
namespace webrtc { namespace webrtc {
SpsParser::SpsState::SpsState() = default;
// General note: this is based off the 02/2014 version of the H.264 standard. // General note: this is based off the 02/2014 version of the H.264 standard.
// You can find it on this page: // You can find it on this page:
// http://www.itu.int/rec/T-REC-H.264 // http://www.itu.int/rec/T-REC-H.264

View File

@ -25,7 +25,7 @@ class SpsParser {
// The parsed state of the SPS. Only some select values are stored. // The parsed state of the SPS. Only some select values are stored.
// Add more as they are actually needed. // Add more as they are actually needed.
struct SpsState { struct SpsState {
SpsState() = default; SpsState();
uint32_t width = 0; uint32_t width = 0;
uint32_t height = 0; uint32_t height = 0;

View File

@ -36,6 +36,7 @@ rtc_source_set("rtc_event_log_api") {
sources = [ sources = [
"rtc_event_log/encoder/rtc_event_log_encoder.h", "rtc_event_log/encoder/rtc_event_log_encoder.h",
"rtc_event_log/events/rtc_event.h", "rtc_event_log/events/rtc_event.h",
"rtc_event_log/rtc_event_log.cc",
"rtc_event_log/rtc_event_log.h", "rtc_event_log/rtc_event_log.h",
"rtc_event_log/rtc_event_log_factory_interface.h", "rtc_event_log/rtc_event_log_factory_interface.h",
] ]

View File

@ -0,0 +1,21 @@
/*
* 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 "logging/rtc_event_log/rtc_event_log.h"
namespace webrtc {
bool RtcEventLogNullImpl::StartLogging(
std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) {
return false;
}
} // namespace webrtc

View File

@ -57,9 +57,7 @@ class RtcEventLog {
class RtcEventLogNullImpl : public RtcEventLog { class RtcEventLogNullImpl : public RtcEventLog {
public: public:
bool StartLogging(std::unique_ptr<RtcEventLogOutput> output, bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
int64_t output_period_ms) override { int64_t output_period_ms) override;
return false;
}
void StopLogging() override {} void StopLogging() override {}
void Log(std::unique_ptr<RtcEvent> event) override {} void Log(std::unique_ptr<RtcEvent> event) override {}
}; };

View File

@ -34,6 +34,9 @@ static std::string ToString(uint32_t v) {
return ss.str(); return ss.str();
} }
Logging::ThreadState::ThreadState() = default;
Logging::ThreadState::~ThreadState() = default;
Logging::Context::Context(uint32_t name, int64_t timestamp_ms, bool enabled) { Logging::Context::Context(uint32_t name, int64_t timestamp_ms, bool enabled) {
Logging::GetInstance()->PushState(ToString(name), timestamp_ms, enabled); Logging::GetInstance()->PushState(ToString(name), timestamp_ms, enabled);
} }
@ -205,6 +208,8 @@ Logging::Logging()
: thread_map_() { : thread_map_() {
} }
Logging::~Logging() = default;
Logging::State::State() : tag(""), timestamp_ms(0), enabled(true) {} Logging::State::State() : tag(""), timestamp_ms(0), enabled(true) {}
Logging::State::State(const std::string& tag, int64_t timestamp_ms, Logging::State::State(const std::string& tag, int64_t timestamp_ms,

View File

@ -331,12 +331,15 @@ class Logging {
bool enabled; bool enabled;
}; };
struct ThreadState { struct ThreadState {
ThreadState();
~ThreadState();
State global_state; State global_state;
std::stack<State> stack; std::stack<State> stack;
}; };
typedef std::map<uint32_t, ThreadState> ThreadMap; typedef std::map<uint32_t, ThreadState> ThreadMap;
Logging(); Logging();
~Logging();
void PushState(const std::string& append_to_tag, int64_t timestamp_ms, void PushState(const std::string& append_to_tag, int64_t timestamp_ms,
bool enabled); bool enabled);
void PopState(); void PopState();

View File

@ -185,11 +185,6 @@ rtc_static_library("rtp_rtcp") {
defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0" ] defines = [ "BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0" ]
} }
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 = [ deps = [
":rtp_rtcp_format", ":rtp_rtcp_format",
"..:module_api", "..:module_api",

View File

@ -114,7 +114,7 @@ bool FlexfecSender::FecAvailable() const {
std::vector<std::unique_ptr<RtpPacketToSend>> FlexfecSender::GetFecPackets() { std::vector<std::unique_ptr<RtpPacketToSend>> FlexfecSender::GetFecPackets() {
std::vector<std::unique_ptr<RtpPacketToSend>> fec_packets_to_send; std::vector<std::unique_ptr<RtpPacketToSend>> fec_packets_to_send;
fec_packets_to_send.reserve(ulpfec_generator_.generated_fec_packets_.size()); fec_packets_to_send.reserve(ulpfec_generator_.generated_fec_packets_.size());
for (const auto& fec_packet : ulpfec_generator_.generated_fec_packets_) { for (const auto* fec_packet : ulpfec_generator_.generated_fec_packets_) {
std::unique_ptr<RtpPacketToSend> fec_packet_to_send( std::unique_ptr<RtpPacketToSend> fec_packet_to_send(
new RtpPacketToSend(&rtp_header_extension_map_)); new RtpPacketToSend(&rtp_header_extension_map_));

View File

@ -655,7 +655,7 @@ void ForwardErrorCorrection::AttemptRecovery(
continue; continue;
} }
auto recovered_packet_ptr = recovered_packet.get(); auto* recovered_packet_ptr = recovered_packet.get();
// Add recovered packet to the list of recovered packets and update any // Add recovered packet to the list of recovered packets and update any
// FEC packets covering this packet with a pointer to the data. // FEC packets covering this packet with a pointer to the data.
// TODO(holmer): Consider replacing this with a binary search for the // TODO(holmer): Consider replacing this with a binary search for the

View File

@ -26,6 +26,8 @@ PacketLossStats::PacketLossStats()
multiple_loss_historic_packet_count_(0) { multiple_loss_historic_packet_count_(0) {
} }
PacketLossStats::~PacketLossStats() = default;
void PacketLossStats::AddLostPacket(uint16_t sequence_number) { void PacketLossStats::AddLostPacket(uint16_t sequence_number) {
// Detect sequence number wrap around. // Detect sequence number wrap around.
if (!lost_packets_buffer_.empty() && if (!lost_packets_buffer_.empty() &&
@ -77,7 +79,7 @@ void PacketLossStats::ComputeLossCounts(
std::vector<const std::set<uint16_t>*> buffers; std::vector<const std::set<uint16_t>*> buffers;
buffers.push_back(&lost_packets_buffer_); buffers.push_back(&lost_packets_buffer_);
buffers.push_back(&lost_packets_wrapped_buffer_); buffers.push_back(&lost_packets_wrapped_buffer_);
for (auto buffer : buffers) { for (const auto* buffer : buffers) {
for (auto it = buffer->begin(); it != buffer->end(); ++it) { for (auto it = buffer->begin(); it != buffer->end(); ++it) {
uint16_t current_num = *it; uint16_t current_num = *it;
if (sequential_count > 0 && current_num != ((last_num + 1) & 0xFFFF)) { if (sequential_count > 0 && current_num != ((last_num + 1) & 0xFFFF)) {

View File

@ -21,7 +21,7 @@ namespace webrtc {
class PacketLossStats { class PacketLossStats {
public: public:
PacketLossStats(); PacketLossStats();
~PacketLossStats() {} ~PacketLossStats();
// Adds a lost packet to the stats by sequence number. // Adds a lost packet to the stats by sequence number.
void AddLostPacket(uint16_t sequence_number); void AddLostPacket(uint16_t sequence_number);

View File

@ -52,6 +52,8 @@ StreamStatisticianImpl::StreamStatisticianImpl(
rtcp_callback_(rtcp_callback), rtcp_callback_(rtcp_callback),
rtp_callback_(rtp_callback) {} rtp_callback_(rtp_callback) {}
StreamStatisticianImpl::~StreamStatisticianImpl() = default;
void StreamStatisticianImpl::IncomingPacket(const RTPHeader& header, void StreamStatisticianImpl::IncomingPacket(const RTPHeader& header,
size_t packet_length, size_t packet_length,
bool retransmitted) { bool retransmitted) {

View File

@ -29,7 +29,7 @@ class StreamStatisticianImpl : public StreamStatistician {
Clock* clock, Clock* clock,
RtcpStatisticsCallback* rtcp_callback, RtcpStatisticsCallback* rtcp_callback,
StreamDataCountersCallback* rtp_callback); StreamDataCountersCallback* rtp_callback);
virtual ~StreamStatisticianImpl() {} ~StreamStatisticianImpl() override;
// |reset| here and in next method restarts calculation of fraction_lost stat. // |reset| here and in next method restarts calculation of fraction_lost stat.
bool GetStatistics(RtcpStatistics* statistics, bool reset) override; bool GetStatistics(RtcpStatistics* statistics, bool reset) override;
@ -96,7 +96,7 @@ class ReceiveStatisticsImpl : public ReceiveStatistics,
public: public:
explicit ReceiveStatisticsImpl(Clock* clock); explicit ReceiveStatisticsImpl(Clock* clock);
~ReceiveStatisticsImpl(); ~ReceiveStatisticsImpl() override;
// Implement ReceiveStatisticsProvider. // Implement ReceiveStatisticsProvider.
std::vector<rtcp::ReportBlock> RtcpReportBlocks(size_t max_blocks) override; std::vector<rtcp::ReportBlock> RtcpReportBlocks(size_t max_blocks) override;

View File

@ -21,6 +21,7 @@ namespace webrtc {
namespace rtcp { namespace rtcp {
constexpr uint8_t SenderReport::kPacketType; constexpr uint8_t SenderReport::kPacketType;
constexpr size_t SenderReport::kMaxNumberOfReportBlocks; constexpr size_t SenderReport::kMaxNumberOfReportBlocks;
constexpr size_t SenderReport::kSenderBaseLength;
// Sender report (SR) (RFC 3550). // Sender report (SR) (RFC 3550).
// 0 1 2 3 // 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
@ -46,6 +47,10 @@ SenderReport::SenderReport()
sender_packet_count_(0), sender_packet_count_(0),
sender_octet_count_(0) {} sender_octet_count_(0) {}
SenderReport::SenderReport(const SenderReport&) = default;
SenderReport::SenderReport(SenderReport&&) = default;
SenderReport& SenderReport::operator=(const SenderReport&) = default;
SenderReport& SenderReport::operator=(SenderReport&&) = default;
SenderReport::~SenderReport() = default; SenderReport::~SenderReport() = default;
bool SenderReport::Parse(const CommonHeader& packet) { bool SenderReport::Parse(const CommonHeader& packet) {

View File

@ -27,6 +27,10 @@ class SenderReport : public RtcpPacket {
static constexpr size_t kMaxNumberOfReportBlocks = 0x1f; static constexpr size_t kMaxNumberOfReportBlocks = 0x1f;
SenderReport(); SenderReport();
SenderReport(const SenderReport&);
SenderReport(SenderReport&&);
SenderReport& operator=(const SenderReport&);
SenderReport& operator=(SenderReport&&);
~SenderReport() override; ~SenderReport() override;
// Parse assumes header is already parsed and validated. // Parse assumes header is already parsed and validated.
@ -65,7 +69,7 @@ class SenderReport : public RtcpPacket {
PacketReadyCallback callback) const override; PacketReadyCallback callback) const override;
private: private:
const size_t kSenderBaseLength = 24; static constexpr size_t kSenderBaseLength = 24;
uint32_t sender_ssrc_; uint32_t sender_ssrc_;
NtpTime ntp_; NtpTime ntp_;

View File

@ -92,7 +92,7 @@ class PacketContainer : public rtcp::CompoundPacket {
public: public:
PacketContainer(Transport* transport, RtcEventLog* event_log) PacketContainer(Transport* transport, RtcEventLog* event_log)
: transport_(transport), event_log_(event_log) {} : transport_(transport), event_log_(event_log) {}
virtual ~PacketContainer() { ~PacketContainer() override {
for (RtcpPacket* packet : appended_packets_) for (RtcpPacket* packet : appended_packets_)
delete packet; delete packet;
} }

View File

@ -95,6 +95,8 @@ RtpPacketizerH264::RtpPacketizerH264(size_t max_payload_len,
RtpPacketizerH264::~RtpPacketizerH264() { RtpPacketizerH264::~RtpPacketizerH264() {
} }
RtpPacketizerH264::Fragment::~Fragment() = default;
RtpPacketizerH264::Fragment::Fragment(const uint8_t* buffer, size_t length) RtpPacketizerH264::Fragment::Fragment(const uint8_t* buffer, size_t length)
: buffer(buffer), length(length) {} : buffer(buffer), length(length) {}
RtpPacketizerH264::Fragment::Fragment(const Fragment& fragment) RtpPacketizerH264::Fragment::Fragment(const Fragment& fragment)

View File

@ -30,7 +30,7 @@ class RtpPacketizerH264 : public RtpPacketizer {
size_t last_packet_reduction_len, size_t last_packet_reduction_len,
H264PacketizationMode packetization_mode); H264PacketizationMode packetization_mode);
virtual ~RtpPacketizerH264(); ~RtpPacketizerH264() override;
size_t SetPayloadData(const uint8_t* payload_data, size_t SetPayloadData(const uint8_t* payload_data,
size_t payload_size, size_t payload_size,
@ -49,6 +49,7 @@ class RtpPacketizerH264 : public RtpPacketizer {
struct Fragment { struct Fragment {
Fragment(const uint8_t* buffer, size_t length); Fragment(const uint8_t* buffer, size_t length);
explicit Fragment(const Fragment& fragment); explicit Fragment(const Fragment& fragment);
~Fragment();
const uint8_t* buffer = nullptr; const uint8_t* buffer = nullptr;
size_t length = 0; size_t length = 0;
std::unique_ptr<rtc::Buffer> tmp_buffer; std::unique_ptr<rtc::Buffer> tmp_buffer;
@ -100,7 +101,7 @@ class RtpPacketizerH264 : public RtpPacketizer {
class RtpDepacketizerH264 : public RtpDepacketizer { class RtpDepacketizerH264 : public RtpDepacketizer {
public: public:
RtpDepacketizerH264(); RtpDepacketizerH264();
virtual ~RtpDepacketizerH264(); ~RtpDepacketizerH264() override;
bool Parse(ParsedPayload* parsed_payload, bool Parse(ParsedPayload* parsed_payload,
const uint8_t* payload_data, const uint8_t* payload_data,

View File

@ -112,6 +112,8 @@ std::string RtpPacketizerGeneric::ToString() {
return "RtpPacketizerGeneric"; return "RtpPacketizerGeneric";
} }
RtpDepacketizerGeneric::~RtpDepacketizerGeneric() = default;
bool RtpDepacketizerGeneric::Parse(ParsedPayload* parsed_payload, bool RtpDepacketizerGeneric::Parse(ParsedPayload* parsed_payload,
const uint8_t* payload_data, const uint8_t* payload_data,
size_t payload_data_length) { size_t payload_data_length) {

View File

@ -31,7 +31,7 @@ class RtpPacketizerGeneric : public RtpPacketizer {
size_t max_payload_len, size_t max_payload_len,
size_t last_packet_reduction_len); size_t last_packet_reduction_len);
virtual ~RtpPacketizerGeneric(); ~RtpPacketizerGeneric() override;
// Returns total number of packets to be generated. // Returns total number of packets to be generated.
size_t SetPayloadData(const uint8_t* payload_data, size_t SetPayloadData(const uint8_t* payload_data,
@ -64,7 +64,7 @@ class RtpPacketizerGeneric : public RtpPacketizer {
// Depacketizer for generic codec. // Depacketizer for generic codec.
class RtpDepacketizerGeneric : public RtpDepacketizer { class RtpDepacketizerGeneric : public RtpDepacketizer {
public: public:
virtual ~RtpDepacketizerGeneric() {} ~RtpDepacketizerGeneric() override;
bool Parse(ParsedPayload* parsed_payload, bool Parse(ParsedPayload* parsed_payload,
const uint8_t* payload_data, const uint8_t* payload_data,

View File

@ -45,7 +45,7 @@ class RtpPacketizerVp8 : public RtpPacketizer {
size_t max_payload_len, size_t max_payload_len,
size_t last_packet_reduction_len); size_t last_packet_reduction_len);
virtual ~RtpPacketizerVp8(); ~RtpPacketizerVp8() override;
size_t SetPayloadData(const uint8_t* payload_data, size_t SetPayloadData(const uint8_t* payload_data,
size_t payload_size, size_t payload_size,
@ -159,7 +159,7 @@ class RtpPacketizerVp8 : public RtpPacketizer {
// Depacketizer for VP8. // Depacketizer for VP8.
class RtpDepacketizerVp8 : public RtpDepacketizer { class RtpDepacketizerVp8 : public RtpDepacketizer {
public: public:
virtual ~RtpDepacketizerVp8() {} ~RtpDepacketizerVp8() override = default;
bool Parse(ParsedPayload* parsed_payload, bool Parse(ParsedPayload* parsed_payload,
const uint8_t* payload_data, const uint8_t* payload_data,

View File

@ -37,7 +37,7 @@ class RtpPacketizerVp9 : public RtpPacketizer {
size_t max_payload_length, size_t max_payload_length,
size_t last_packet_reduction_len); size_t last_packet_reduction_len);
virtual ~RtpPacketizerVp9(); ~RtpPacketizerVp9() override;
std::string ToString() override; std::string ToString() override;
@ -90,7 +90,7 @@ class RtpPacketizerVp9 : public RtpPacketizer {
class RtpDepacketizerVp9 : public RtpDepacketizer { class RtpDepacketizerVp9 : public RtpDepacketizer {
public: public:
virtual ~RtpDepacketizerVp9() {} ~RtpDepacketizerVp9() override = default;
bool Parse(ParsedPayload* parsed_payload, bool Parse(ParsedPayload* parsed_payload,
const uint8_t* payload, const uint8_t* payload,

View File

@ -18,7 +18,7 @@ namespace webrtc {
class RtpHeaderParserImpl : public RtpHeaderParser { class RtpHeaderParserImpl : public RtpHeaderParser {
public: public:
RtpHeaderParserImpl(); RtpHeaderParserImpl();
virtual ~RtpHeaderParserImpl() {} ~RtpHeaderParserImpl() override = default;
bool Parse(const uint8_t* packet, bool Parse(const uint8_t* packet,
size_t length, size_t length,

View File

@ -29,6 +29,12 @@ constexpr int kMinPacketDurationRtt = 3;
} // namespace } // namespace
constexpr size_t RtpPacketHistory::kMaxCapacity; constexpr size_t RtpPacketHistory::kMaxCapacity;
RtpPacketHistory::StoredPacket::StoredPacket() = default;
RtpPacketHistory::StoredPacket::StoredPacket(StoredPacket&&) = default;
RtpPacketHistory::StoredPacket& RtpPacketHistory::StoredPacket::operator=(
RtpPacketHistory::StoredPacket&&) = default;
RtpPacketHistory::StoredPacket::~StoredPacket() = default;
RtpPacketHistory::RtpPacketHistory(Clock* clock) RtpPacketHistory::RtpPacketHistory(Clock* clock)
: clock_(clock), store_(false), prev_index_(0), rtt_ms_(-1) {} : clock_(clock), store_(false), prev_index_(0), rtt_ms_(-1) {}

View File

@ -60,6 +60,10 @@ class RtpPacketHistory {
private: private:
struct StoredPacket { struct StoredPacket {
StoredPacket();
StoredPacket(StoredPacket&&);
StoredPacket& operator=(StoredPacket&&);
~StoredPacket();
uint16_t sequence_number = 0; uint16_t sequence_number = 0;
int64_t send_time = 0; int64_t send_time = 0;
StorageType storage_type = kDontRetransmit; StorageType storage_type = kDontRetransmit;

View File

@ -38,6 +38,8 @@ RTPReceiverAudio::RTPReceiverAudio(RtpData* data_callback)
memset(current_remote_energy_, 0, sizeof(current_remote_energy_)); memset(current_remote_energy_, 0, sizeof(current_remote_energy_));
} }
RTPReceiverAudio::~RTPReceiverAudio() = default;
// Outband TelephoneEvent(DTMF) detection // Outband TelephoneEvent(DTMF) detection
void RTPReceiverAudio::SetTelephoneEventForwardToDecoder( void RTPReceiverAudio::SetTelephoneEventForwardToDecoder(
bool forward_to_decoder) { bool forward_to_decoder) {
@ -57,6 +59,10 @@ bool RTPReceiverAudio::TelephoneEventPayloadType(
return telephone_event_payload_type_ == payload_type; return telephone_event_payload_type_ == payload_type;
} }
TelephoneEventHandler* RTPReceiverAudio::GetTelephoneEventHandler() {
return this;
}
bool RTPReceiverAudio::CNGPayloadType(int8_t payload_type) { bool RTPReceiverAudio::CNGPayloadType(int8_t payload_type) {
rtc::CritScope lock(&crit_sect_); rtc::CritScope lock(&crit_sect_);
return payload_type == cng_nb_payload_type_ || return payload_type == cng_nb_payload_type_ ||

View File

@ -27,7 +27,7 @@ class RTPReceiverAudio : public RTPReceiverStrategy,
public TelephoneEventHandler { public TelephoneEventHandler {
public: public:
explicit RTPReceiverAudio(RtpData* data_callback); explicit RTPReceiverAudio(RtpData* data_callback);
virtual ~RTPReceiverAudio() {} ~RTPReceiverAudio() override;
// The following three methods implement the TelephoneEventHandler interface. // The following three methods implement the TelephoneEventHandler interface.
// Forward DTMFs to decoder for playout. // Forward DTMFs to decoder for playout.
@ -39,7 +39,7 @@ class RTPReceiverAudio : public RTPReceiverStrategy,
// Is TelephoneEvent configured with |payload_type|. // Is TelephoneEvent configured with |payload_type|.
bool TelephoneEventPayloadType(const int8_t payload_type) const override; bool TelephoneEventPayloadType(const int8_t payload_type) const override;
TelephoneEventHandler* GetTelephoneEventHandler() override { return this; } TelephoneEventHandler* GetTelephoneEventHandler() override;
// Returns true if CNG is configured with |payload_type|. // Returns true if CNG is configured with |payload_type|.
bool CNGPayloadType(const int8_t payload_type); bool CNGPayloadType(const int8_t payload_type);

View File

@ -35,7 +35,7 @@ class RtpReceiverImpl : public RtpReceiver {
RTPPayloadRegistry* rtp_payload_registry, RTPPayloadRegistry* rtp_payload_registry,
RTPReceiverStrategy* rtp_media_receiver); RTPReceiverStrategy* rtp_media_receiver);
virtual ~RtpReceiverImpl(); ~RtpReceiverImpl() override;
int32_t RegisterReceivePayload(int payload_type, int32_t RegisterReceivePayload(int payload_type,
const SdpAudioFormat& audio_format) override; const SdpAudioFormat& audio_format) override;

View File

@ -17,6 +17,8 @@ namespace webrtc {
RTPReceiverStrategy::RTPReceiverStrategy(RtpData* data_callback) RTPReceiverStrategy::RTPReceiverStrategy(RtpData* data_callback)
: data_callback_(data_callback) {} : data_callback_(data_callback) {}
RTPReceiverStrategy::~RTPReceiverStrategy() = default;
void RTPReceiverStrategy::GetLastMediaSpecificPayload( void RTPReceiverStrategy::GetLastMediaSpecificPayload(
PayloadUnion* payload) const { PayloadUnion* payload) const {
rtc::CritScope cs(&crit_sect_); rtc::CritScope cs(&crit_sect_);

View File

@ -30,7 +30,7 @@ class RTPReceiverStrategy {
static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback); static RTPReceiverStrategy* CreateVideoStrategy(RtpData* data_callback);
static RTPReceiverStrategy* CreateAudioStrategy(RtpData* data_callback); static RTPReceiverStrategy* CreateAudioStrategy(RtpData* data_callback);
virtual ~RTPReceiverStrategy() {} virtual ~RTPReceiverStrategy();
// Parses the RTP packet and calls the data callback with the payload data. // Parses the RTP packet and calls the data callback with the payload data.
// Implementations are encouraged to use the provided packet buffer and RTP // Implementations are encouraged to use the provided packet buffer and RTP

View File

@ -119,6 +119,10 @@ int32_t RTPReceiverVideo::ParseRtpPacket(WebRtcRTPHeader* rtp_header,
: -1; : -1;
} }
TelephoneEventHandler* RTPReceiverVideo::GetTelephoneEventHandler() {
return nullptr;
}
RTPAliveType RTPReceiverVideo::ProcessDeadOrAlive( RTPAliveType RTPReceiverVideo::ProcessDeadOrAlive(
uint16_t last_payload_length) const { uint16_t last_payload_length) const {
return kRtpDead; return kRtpDead;

View File

@ -23,7 +23,7 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
public: public:
explicit RTPReceiverVideo(RtpData* data_callback); explicit RTPReceiverVideo(RtpData* data_callback);
virtual ~RTPReceiverVideo(); ~RTPReceiverVideo() override;
int32_t ParseRtpPacket(WebRtcRTPHeader* rtp_header, int32_t ParseRtpPacket(WebRtcRTPHeader* rtp_header,
const PayloadUnion& specific_payload, const PayloadUnion& specific_payload,
@ -32,7 +32,7 @@ class RTPReceiverVideo : public RTPReceiverStrategy {
size_t packet_length, size_t packet_length,
int64_t timestamp) override; int64_t timestamp) override;
TelephoneEventHandler* GetTelephoneEventHandler() override { return NULL; } TelephoneEventHandler* GetTelephoneEventHandler() override;
RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override; RTPAliveType ProcessDeadOrAlive(uint16_t last_payload_length) const override;

View File

@ -142,6 +142,8 @@ ModuleRtpRtcpImpl::ModuleRtpRtcpImpl(const Configuration& configuration)
SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize); SetMaxRtpPacketSize(IP_PACKET_SIZE - kTcpOverIpv4HeaderSize);
} }
ModuleRtpRtcpImpl::~ModuleRtpRtcpImpl() = default;
// Returns the number of milliseconds until the module want a worker thread // Returns the number of milliseconds until the module want a worker thread
// to call Process. // to call Process.
int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() { int64_t ModuleRtpRtcpImpl::TimeUntilNextProcess() {

View File

@ -31,6 +31,7 @@ namespace webrtc {
class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp { class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
public: public:
explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration); explicit ModuleRtpRtcpImpl(const RtpRtcp::Configuration& configuration);
~ModuleRtpRtcpImpl() override;
// Returns the number of milliseconds until the module want a worker thread to // Returns the number of milliseconds until the module want a worker thread to
// call Process. // call Process.

View File

@ -62,6 +62,8 @@ constexpr uint32_t kUnknownSsrc = 0;
RedPacket::RedPacket(size_t length) RedPacket::RedPacket(size_t length)
: data_(new uint8_t[length]), length_(length), header_length_(0) {} : data_(new uint8_t[length]), length_(length), header_length_(0) {}
RedPacket::~RedPacket() = default;
void RedPacket::CreateHeader(const uint8_t* rtp_header, void RedPacket::CreateHeader(const uint8_t* rtp_header,
size_t header_length, size_t header_length,
int red_payload_type, int red_payload_type,
@ -213,7 +215,7 @@ std::vector<std::unique_ptr<RedPacket>> UlpfecGenerator::GetUlpfecPacketsAsRed(
ForwardErrorCorrection::Packet* last_media_packet = ForwardErrorCorrection::Packet* last_media_packet =
media_packets_.back().get(); media_packets_.back().get();
uint16_t seq_num = first_seq_num; uint16_t seq_num = first_seq_num;
for (const auto& fec_packet : generated_fec_packets_) { for (const auto* fec_packet : generated_fec_packets_) {
// Wrap FEC packet (including FEC headers) in a RED packet. Since the // Wrap FEC packet (including FEC headers) in a RED packet. Since the
// FEC packets in |generated_fec_packets_| don't have RTP headers, we // FEC packets in |generated_fec_packets_| don't have RTP headers, we
// reuse the header from the last media packet. // reuse the header from the last media packet.

View File

@ -24,6 +24,7 @@ class FlexfecSender;
class RedPacket { class RedPacket {
public: public:
explicit RedPacket(size_t length); explicit RedPacket(size_t length);
~RedPacket();
void CreateHeader(const uint8_t* rtp_header, void CreateHeader(const uint8_t* rtp_header,
size_t header_length, size_t header_length,

View File

@ -25,7 +25,7 @@ namespace webrtc {
class UlpfecReceiverImpl : public UlpfecReceiver { class UlpfecReceiverImpl : public UlpfecReceiver {
public: public:
explicit UlpfecReceiverImpl(uint32_t ssrc, RecoveredPacketReceiver* callback); explicit UlpfecReceiverImpl(uint32_t ssrc, RecoveredPacketReceiver* callback);
virtual ~UlpfecReceiverImpl(); ~UlpfecReceiverImpl() override;
int32_t AddReceivedRedPacket(const RTPHeader& rtp_header, int32_t AddReceivedRedPacket(const RTPHeader& rtp_header,
const uint8_t* incoming_rtp_packet, const uint8_t* incoming_rtp_packet,