Index: webrtc/api/rtpsender.h |
diff --git a/webrtc/api/rtpsender.h b/webrtc/api/rtpsender.h |
index c8a46a80e4d7d462cb6d193e98f8c80425f071cc..a0bcc9407abf10bba024cf625f880a6bf8ee5885 100644 |
--- a/webrtc/api/rtpsender.h |
+++ b/webrtc/api/rtpsender.h |
@@ -27,6 +27,22 @@ |
namespace webrtc { |
+// Internal interface used by PeerConnection. |
+class RtpSenderInternal : public RtpSenderInterface { |
+ public: |
+ // Used to set the SSRC of the sender, once a local description has been set. |
+ // If |ssrc| is 0, this indiates that the sender should disconnect from the |
+ // underlying transport (this occurs if the sender isn't seen in a local |
+ // description). |
+ virtual void SetSsrc(uint32_t ssrc) = 0; |
+ |
+ // TODO(deadbeef): Support one sender having multiple stream ids. |
+ virtual void set_stream_id(const std::string& stream_id) = 0; |
+ virtual std::string stream_id() const = 0; |
+ |
+ virtual void Stop() = 0; |
+}; |
+ |
// LocalAudioSinkAdapter receives data callback as a sink to the local |
// AudioTrack, and passes the data to the sink of AudioSource. |
class LocalAudioSinkAdapter : public AudioTrackSinkInterface, |
@@ -52,7 +68,7 @@ class LocalAudioSinkAdapter : public AudioTrackSinkInterface, |
}; |
class AudioRtpSender : public ObserverInterface, |
- public rtc::RefCountedObject<RtpSenderInterface> { |
+ public rtc::RefCountedObject<RtpSenderInternal> { |
public: |
// StatsCollector provided so that Add/RemoveLocalAudioTrack can be called |
// at the appropriate times. |
@@ -77,11 +93,9 @@ class AudioRtpSender : public ObserverInterface, |
// RtpSenderInterface implementation |
bool SetTrack(MediaStreamTrackInterface* track) override; |
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { |
- return track_.get(); |
+ return track_; |
} |
- void SetSsrc(uint32_t ssrc) override; |
- |
uint32_t ssrc() const override { return ssrc_; } |
cricket::MediaType media_type() const override { |
@@ -90,6 +104,17 @@ class AudioRtpSender : public ObserverInterface, |
std::string id() const override { return id_; } |
+ std::vector<std::string> stream_ids() const override { |
+ std::vector<std::string> ret = {stream_id_}; |
+ return ret; |
+ } |
+ |
+ RtpParameters GetParameters() const override; |
+ bool SetParameters(const RtpParameters& parameters) override; |
+ |
+ // RtpSenderInternal implementation. |
+ void SetSsrc(uint32_t ssrc) override; |
+ |
void set_stream_id(const std::string& stream_id) override { |
stream_id_ = stream_id; |
} |
@@ -97,9 +122,6 @@ class AudioRtpSender : public ObserverInterface, |
void Stop() override; |
- RtpParameters GetParameters() const override; |
- bool SetParameters(const RtpParameters& parameters) override; |
- |
private: |
// TODO(nisse): Since SSRC == 0 is technically valid, figure out |
// some other way to test if we have a valid SSRC. |
@@ -123,7 +145,7 @@ class AudioRtpSender : public ObserverInterface, |
}; |
class VideoRtpSender : public ObserverInterface, |
- public rtc::RefCountedObject<RtpSenderInterface> { |
+ public rtc::RefCountedObject<RtpSenderInternal> { |
public: |
VideoRtpSender(VideoTrackInterface* track, |
const std::string& stream_id, |
@@ -143,11 +165,9 @@ class VideoRtpSender : public ObserverInterface, |
// RtpSenderInterface implementation |
bool SetTrack(MediaStreamTrackInterface* track) override; |
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override { |
- return track_.get(); |
+ return track_; |
} |
- void SetSsrc(uint32_t ssrc) override; |
- |
uint32_t ssrc() const override { return ssrc_; } |
cricket::MediaType media_type() const override { |
@@ -156,6 +176,17 @@ class VideoRtpSender : public ObserverInterface, |
std::string id() const override { return id_; } |
+ std::vector<std::string> stream_ids() const override { |
+ std::vector<std::string> ret = {stream_id_}; |
+ return ret; |
+ } |
+ |
+ RtpParameters GetParameters() const override; |
+ bool SetParameters(const RtpParameters& parameters) override; |
+ |
+ // RtpSenderInternal implementation. |
+ void SetSsrc(uint32_t ssrc) override; |
+ |
void set_stream_id(const std::string& stream_id) override { |
stream_id_ = stream_id; |
} |
@@ -163,9 +194,6 @@ class VideoRtpSender : public ObserverInterface, |
void Stop() override; |
- RtpParameters GetParameters() const override; |
- bool SetParameters(const RtpParameters& parameters) override; |
- |
private: |
bool can_send_track() const { return track_ && ssrc_; } |
// Helper function to construct options for |