Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Unified Diff: talk/app/webrtc/rtpsender.h

Issue 1413713003: Adding the ability to create an RtpSender without a track. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding some unit tests for new methods on the sender. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/rtpsender.h
diff --git a/talk/app/webrtc/rtpsender.h b/talk/app/webrtc/rtpsender.h
index 374190932325bb9715ed4b477b61556177833935..934f8c3581c764a44f9fb1f1e97ba75f5ea5a20a 100644
--- a/talk/app/webrtc/rtpsender.h
+++ b/talk/app/webrtc/rtpsender.h
@@ -36,6 +36,7 @@
#include "talk/app/webrtc/mediastreamprovider.h"
#include "talk/app/webrtc/rtpsenderinterface.h"
+#include "talk/app/webrtc/statscollector.h"
#include "talk/media/base/audiorenderer.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
@@ -70,9 +71,15 @@ class LocalAudioSinkAdapter : public AudioTrackSinkInterface,
class AudioRtpSender : public ObserverInterface,
public rtc::RefCountedObject<RtpSenderInterface> {
public:
+ // StatsCollector provided so that Add/RemoveLocalAudioTrack can be called
+ // at the appropriate times.
AudioRtpSender(AudioTrackInterface* track,
- uint32_t ssrc,
- AudioProviderInterface* provider);
+ const std::string& stream_id,
+ AudioProviderInterface* provider,
+ StatsCollector* stats);
+
+ // Randomly generates id and stream_id.
+ AudioRtpSender(AudioProviderInterface* provider, StatsCollector* stats);
virtual ~AudioRtpSender();
@@ -85,18 +92,34 @@ class AudioRtpSender : public ObserverInterface,
return track_.get();
}
+ void SetSsrc(uint32_t ssrc) override;
+
+ uint32_t ssrc() const override { return ssrc_; }
+
+ std::string kind() const override { return "audio"; }
+
std::string id() const override { return id_; }
+ void set_stream_id(const std::string& stream_id) override {
+ stream_id_ = stream_id;
+ }
+ std::string stream_id() const override { return stream_id_; }
+
void Stop() override;
private:
- void Reconfigure();
+ // Helper function to construct options for
+ // AudioProviderInterface::SetAudioSend.
+ void SetAudioSend();
std::string id_;
- rtc::scoped_refptr<AudioTrackInterface> track_;
- uint32_t ssrc_;
+ std::string stream_id_;
AudioProviderInterface* provider_;
- bool cached_track_enabled_;
+ StatsCollector* stats_;
+ rtc::scoped_refptr<AudioTrackInterface> track_;
+ uint32_t ssrc_ = 0;
pthatcher1 2015/10/20 17:42:49 Can you put a comment about how 0 is "unset" and w
Taylor Brandstetter 2015/10/21 00:22:08 It's in rtpsenderinterface.h.
+ bool cached_track_enabled_ = false;
+ bool stopped_ = false;
// Used to pass the data callback from the |track_| to the other end of
// cricket::AudioRenderer.
@@ -107,9 +130,12 @@ class VideoRtpSender : public ObserverInterface,
public rtc::RefCountedObject<RtpSenderInterface> {
public:
VideoRtpSender(VideoTrackInterface* track,
- uint32_t ssrc,
+ const std::string& stream_id,
VideoProviderInterface* provider);
+ // Randomly generates id and stream_id.
+ explicit VideoRtpSender(VideoProviderInterface* provider);
+
virtual ~VideoRtpSender();
// ObserverInterface implementation
@@ -121,18 +147,33 @@ class VideoRtpSender : public ObserverInterface,
return track_.get();
}
+ void SetSsrc(uint32_t ssrc) override;
+
+ uint32_t ssrc() const override { return ssrc_; }
+
+ std::string kind() const override { return "video"; }
+
std::string id() const override { return id_; }
+ void set_stream_id(const std::string& stream_id) override {
+ stream_id_ = stream_id;
+ }
+ std::string stream_id() const override { return stream_id_; }
+
void Stop() override;
private:
- void Reconfigure();
+ // Helper function to construct options for
+ // VideoProviderInterface::SetVideoSend.
+ void SetVideoSend();
std::string id_;
- rtc::scoped_refptr<VideoTrackInterface> track_;
- uint32_t ssrc_;
+ std::string stream_id_;
VideoProviderInterface* provider_;
- bool cached_track_enabled_;
+ rtc::scoped_refptr<VideoTrackInterface> track_;
+ uint32_t ssrc_ = 0;
+ bool cached_track_enabled_ = false;
+ bool stopped_ = false;
};
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698