Separating internal and external methods of RtpSender/RtpReceiver.
This moves the implementation specific methods to separate classes
(RtpSenderInternal/RtpReceiverInternal) so that the interface classes
represent the interface that external applications can rely on.
The reason this wasn't done earlier was that PeerConnection needed
to store proxy pointers, but also needed to access implementation-
specific methods on the underlying objects. This is now possible
by using "RtpSenderProxyWithInternal<RtpSenderInternal>", which is a proxy
that implements RtpSenderInterface but also provides direct access
to an RtpSenderInternal.
Review-Url: https://codereview.webrtc.org/2023373002
Cr-Commit-Position: refs/heads/master@{#13056}
diff --git a/webrtc/api/rtpreceiver.h b/webrtc/api/rtpreceiver.h
index 2e7339d..001264d 100644
--- a/webrtc/api/rtpreceiver.h
+++ b/webrtc/api/rtpreceiver.h
@@ -26,9 +26,15 @@
namespace webrtc {
+// Internal class used by PeerConnection.
+class RtpReceiverInternal : public RtpReceiverInterface {
+ public:
+ virtual void Stop() = 0;
+};
+
class AudioRtpReceiver : public ObserverInterface,
public AudioSourceInterface::AudioObserver,
- public rtc::RefCountedObject<RtpReceiverInterface> {
+ public rtc::RefCountedObject<RtpReceiverInternal> {
public:
AudioRtpReceiver(MediaStreamInterface* stream,
const std::string& track_id,
@@ -54,11 +60,12 @@
std::string id() const override { return id_; }
- void Stop() override;
-
RtpParameters GetParameters() const override;
bool SetParameters(const RtpParameters& parameters) override;
+ // RtpReceiverInternal implementation.
+ void Stop() override;
+
private:
void Reconfigure();
@@ -69,7 +76,7 @@
bool cached_track_enabled_;
};
-class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> {
+class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal> {
public:
VideoRtpReceiver(MediaStreamInterface* stream,
const std::string& track_id,
@@ -90,11 +97,12 @@
std::string id() const override { return id_; }
- void Stop() override;
-
RtpParameters GetParameters() const override;
bool SetParameters(const RtpParameters& parameters) override;
+ // RtpReceiverInternal implementation.
+ void Stop() override;
+
private:
std::string id_;
uint32_t ssrc_;