aboutsummaryrefslogtreecommitdiff
path: root/cast
diff options
context:
space:
mode:
authorAbraham Corea Diaz <abrahamcd@google.com>2021-07-09 23:35:39 +0000
committerOpenscreen LUCI CQ <openscreen-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-07-14 01:27:13 +0000
commitbffb5c2247c5705401499ff13b686b119d9918b6 (patch)
tree37035bdd2216518204b6e52d7ba353368258febf /cast
parent7e167e2bc4c8c0c650f00b995e1e20cb1ae1f479 (diff)
downloadopenscreen-bffb5c2247c5705401499ff13b686b119d9918b6.tar.gz
Define virtual destructors in Client interfaces.
This patch adds virtual destructors to all Client and Delegate interfaces that did not have one. Bug: b/156129407 Change-Id: I8b7365ab8a38b9e76a45ced08dd94d1aa595209b Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/3011415 Commit-Queue: Jordan Bayles <jophba@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org> Reviewed-by: mark a. foltz <mfoltz@chromium.org>
Diffstat (limited to 'cast')
-rw-r--r--cast/common/channel/cast_socket.cc2
-rw-r--r--cast/common/public/cast_socket.h4
-rw-r--r--cast/common/public/message_port.h4
-rw-r--r--cast/receiver/channel/receiver_socket_factory.cc2
-rw-r--r--cast/receiver/public/receiver_socket_factory.h4
-rw-r--r--cast/sender/channel/sender_socket_factory.cc2
-rw-r--r--cast/sender/public/sender_socket_factory.h4
-rw-r--r--cast/standalone_receiver/decoder.h2
-rw-r--r--cast/standalone_receiver/streaming_playback_controller.cc2
-rw-r--r--cast/standalone_receiver/streaming_playback_controller.h3
-rw-r--r--cast/streaming/compound_rtcp_parser.h4
-rw-r--r--cast/streaming/compound_rtcp_parser_fuzzer.cc7
12 files changed, 35 insertions, 5 deletions
diff --git a/cast/common/channel/cast_socket.cc b/cast/common/channel/cast_socket.cc
index 0479c997..e06cde46 100644
--- a/cast/common/channel/cast_socket.cc
+++ b/cast/common/channel/cast_socket.cc
@@ -14,6 +14,8 @@ namespace cast {
using ::cast::channel::CastMessage;
using message_serialization::DeserializeResult;
+CastSocket::Client::~Client() = default;
+
CastSocket::CastSocket(std::unique_ptr<TlsConnection> connection,
Client* client)
: connection_(std::move(connection)),
diff --git a/cast/common/public/cast_socket.h b/cast/common/public/cast_socket.h
index 5c0b8775..330b1962 100644
--- a/cast/common/public/cast_socket.h
+++ b/cast/common/public/cast_socket.h
@@ -28,13 +28,15 @@ class CastSocket : public TlsConnection::Client {
public:
class Client {
public:
- virtual ~Client() = default;
// Called when a terminal error on |socket| has occurred.
virtual void OnError(CastSocket* socket, Error error) = 0;
virtual void OnMessage(CastSocket* socket,
::cast::channel::CastMessage message) = 0;
+
+ protected:
+ virtual ~Client();
};
CastSocket(std::unique_ptr<TlsConnection> connection, Client* client);
diff --git a/cast/common/public/message_port.h b/cast/common/public/message_port.h
index 23094740..91eabcd1 100644
--- a/cast/common/public/message_port.h
+++ b/cast/common/public/message_port.h
@@ -20,11 +20,13 @@ class MessagePort {
public:
class Client {
public:
- virtual ~Client() = default;
virtual void OnMessage(const std::string& source_sender_id,
const std::string& message_namespace,
const std::string& message) = 0;
virtual void OnError(Error error) = 0;
+
+ protected:
+ virtual ~Client() = default;
};
virtual ~MessagePort() = default;
diff --git a/cast/receiver/channel/receiver_socket_factory.cc b/cast/receiver/channel/receiver_socket_factory.cc
index e5ba479c..5645bbda 100644
--- a/cast/receiver/channel/receiver_socket_factory.cc
+++ b/cast/receiver/channel/receiver_socket_factory.cc
@@ -9,6 +9,8 @@
namespace openscreen {
namespace cast {
+ReceiverSocketFactory::Client::~Client() = default;
+
ReceiverSocketFactory::ReceiverSocketFactory(Client* client,
CastSocket::Client* socket_client)
: client_(client), socket_client_(socket_client) {
diff --git a/cast/receiver/public/receiver_socket_factory.h b/cast/receiver/public/receiver_socket_factory.h
index 0e2e4e1c..612ffc47 100644
--- a/cast/receiver/public/receiver_socket_factory.h
+++ b/cast/receiver/public/receiver_socket_factory.h
@@ -5,6 +5,7 @@
#ifndef CAST_RECEIVER_PUBLIC_RECEIVER_SOCKET_FACTORY_H_
#define CAST_RECEIVER_PUBLIC_RECEIVER_SOCKET_FACTORY_H_
+#include <memory>
#include <vector>
#include "cast/common/public/cast_socket.h"
@@ -22,6 +23,9 @@ class ReceiverSocketFactory final : public TlsConnectionFactory::Client {
const IPEndpoint& endpoint,
std::unique_ptr<CastSocket> socket) = 0;
virtual void OnError(ReceiverSocketFactory* factory, Error error) = 0;
+
+ protected:
+ virtual ~Client();
};
// |client| and |socket_client| must outlive |this|.
diff --git a/cast/sender/channel/sender_socket_factory.cc b/cast/sender/channel/sender_socket_factory.cc
index abbabfd6..c0924836 100644
--- a/cast/sender/channel/sender_socket_factory.cc
+++ b/cast/sender/channel/sender_socket_factory.cc
@@ -16,6 +16,8 @@ using ::cast::channel::CastMessage;
namespace openscreen {
namespace cast {
+SenderSocketFactory::Client::~Client() = default;
+
bool operator<(const std::unique_ptr<SenderSocketFactory::PendingAuth>& a,
int b) {
return a && a->socket->socket_id() < b;
diff --git a/cast/sender/public/sender_socket_factory.h b/cast/sender/public/sender_socket_factory.h
index f0247a28..0b9b05aa 100644
--- a/cast/sender/public/sender_socket_factory.h
+++ b/cast/sender/public/sender_socket_factory.h
@@ -7,6 +7,7 @@
#include <openssl/x509.h>
+#include <memory>
#include <set>
#include <utility>
#include <vector>
@@ -33,6 +34,9 @@ class SenderSocketFactory final : public TlsConnectionFactory::Client,
virtual void OnError(SenderSocketFactory* factory,
const IPEndpoint& endpoint,
Error error) = 0;
+
+ protected:
+ virtual ~Client();
};
enum class DeviceMediaPolicy {
diff --git a/cast/standalone_receiver/decoder.h b/cast/standalone_receiver/decoder.h
index 1d4d0791..30e56553 100644
--- a/cast/standalone_receiver/decoder.h
+++ b/cast/standalone_receiver/decoder.h
@@ -38,7 +38,6 @@ class Decoder {
// Interface for receiving decoded frames and/or errors.
class Client {
public:
- virtual ~Client();
virtual void OnFrameDecoded(FrameId frame_id, const AVFrame& frame) = 0;
virtual void OnDecodeError(FrameId frame_id, std::string message) = 0;
@@ -46,6 +45,7 @@ class Decoder {
protected:
Client();
+ virtual ~Client();
};
// |codec_name| should be the codec_name field from an OFFER message.
diff --git a/cast/standalone_receiver/streaming_playback_controller.cc b/cast/standalone_receiver/streaming_playback_controller.cc
index 46ee0bbb..8c931273 100644
--- a/cast/standalone_receiver/streaming_playback_controller.cc
+++ b/cast/standalone_receiver/streaming_playback_controller.cc
@@ -19,6 +19,8 @@
namespace openscreen {
namespace cast {
+StreamingPlaybackController::Client::~Client() = default;
+
#if defined(CAST_STANDALONE_RECEIVER_HAVE_EXTERNAL_LIBS)
StreamingPlaybackController::StreamingPlaybackController(
TaskRunner* task_runner,
diff --git a/cast/standalone_receiver/streaming_playback_controller.h b/cast/standalone_receiver/streaming_playback_controller.h
index 65a233e5..68f3068d 100644
--- a/cast/standalone_receiver/streaming_playback_controller.h
+++ b/cast/standalone_receiver/streaming_playback_controller.h
@@ -28,6 +28,9 @@ class StreamingPlaybackController final : public ReceiverSession::Client {
public:
virtual void OnPlaybackError(StreamingPlaybackController* controller,
Error error) = 0;
+
+ protected:
+ virtual ~Client();
};
StreamingPlaybackController(TaskRunner* task_runner,
diff --git a/cast/streaming/compound_rtcp_parser.h b/cast/streaming/compound_rtcp_parser.h
index c74bb3ec..a8bb2e39 100644
--- a/cast/streaming/compound_rtcp_parser.h
+++ b/cast/streaming/compound_rtcp_parser.h
@@ -37,7 +37,6 @@ class CompoundRtcpParser {
class Client {
public:
Client();
- virtual ~Client();
// Called when a Receiver Reference Time Report has been parsed.
virtual void OnReceiverReferenceTimeAdvanced(
@@ -70,6 +69,9 @@ class CompoundRtcpParser {
// kAllPacketsLost indicates that all the packets are missing for a frame.
// The argument's elements are in monotonically increasing order.
virtual void OnReceiverIsMissingPackets(std::vector<PacketNack> nacks);
+
+ protected:
+ virtual ~Client();
};
// |session| and |client| must be non-null and must outlive the
diff --git a/cast/streaming/compound_rtcp_parser_fuzzer.cc b/cast/streaming/compound_rtcp_parser_fuzzer.cc
index bb3dd179..05994a3a 100644
--- a/cast/streaming/compound_rtcp_parser_fuzzer.cc
+++ b/cast/streaming/compound_rtcp_parser_fuzzer.cc
@@ -17,6 +17,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
constexpr Ssrc kSenderSsrcInSeedCorpus = 1;
constexpr Ssrc kReceiverSsrcInSeedCorpus = 2;
+ class ClientThatIgnoresEverything : public CompoundRtcpParser::Client {
+ public:
+ ClientThatIgnoresEverything() = default;
+ ~ClientThatIgnoresEverything() override = default;
+ };
// Allocate the RtcpSession and CompoundRtcpParser statically (i.e., one-time
// init) to improve the fuzzer's execution rate. This is because RtcpSession
// also contains a NtpTimeConverter, which samples the system clock at
@@ -26,7 +31,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
#pragma clang diagnostic ignored "-Wexit-time-destructors"
static RtcpSession session(kSenderSsrcInSeedCorpus, kReceiverSsrcInSeedCorpus,
openscreen::Clock::time_point{});
- static CompoundRtcpParser::Client client_that_ignores_everything;
+ static ClientThatIgnoresEverything client_that_ignores_everything;
static CompoundRtcpParser parser(&session, &client_that_ignores_everything);
#pragma clang diagnostic pop