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

Unified Diff: talk/session/media/channel.h

Issue 1246913005: TransportController refactoring (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 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/session/media/channel.h
diff --git a/talk/session/media/channel.h b/talk/session/media/channel.h
index 5f51c07a287cf79aad3c2c82ab4aaa8fafc76834..f10af2cfefa535a795fff41813d1be316331bd5d 100644
--- a/talk/session/media/channel.h
+++ b/talk/session/media/channel.h
@@ -30,12 +30,15 @@
#include <string>
#include <vector>
+#include <map>
+#include <set>
+#include <utility>
#include "talk/media/base/mediachannel.h"
#include "talk/media/base/mediaengine.h"
#include "talk/media/base/streamparams.h"
#include "talk/media/base/videocapturer.h"
-#include "webrtc/p2p/base/session.h"
+#include "webrtc/p2p/base/transportcontroller.h"
#include "webrtc/p2p/client/socketmonitor.h"
#include "talk/session/media/audiomonitor.h"
#include "talk/session/media/bundlefilter.h"
@@ -76,8 +79,11 @@ class BaseChannel
public MediaChannel::NetworkInterface,
public ConnectionStatsGetter {
public:
- BaseChannel(rtc::Thread* thread, MediaChannel* channel, BaseSession* session,
- const std::string& content_name, bool rtcp);
+ BaseChannel(rtc::Thread* thread,
+ MediaChannel* channel,
+ TransportController* transport_controller,
+ const std::string& content_name,
+ bool rtcp);
virtual ~BaseChannel();
bool Init();
// Deinit may be called multiple times and is simply ignored if it's alreay
@@ -85,8 +91,8 @@ class BaseChannel
void Deinit();
rtc::Thread* worker_thread() const { return worker_thread_; }
- BaseSession* session() const { return session_; }
- const std::string& content_name() { return content_name_; }
+ const std::string& content_name() const { return content_name_; }
+ const std::string& transport_name() const { return transport_name_; }
TransportChannel* transport_channel() const {
return transport_channel_;
}
@@ -112,6 +118,7 @@ class BaseChannel
// description doesn't support RTCP mux, setting the remote
// description will fail.
void ActivateRtcpMux();
+ bool SetTransport(const std::string& transport_name);
bool PushdownLocalDescription(const SessionDescription* local_desc,
ContentAction action,
std::string* error_desc);
@@ -141,7 +148,7 @@ class BaseChannel
void StartConnectionMonitor(int cms);
void StopConnectionMonitor();
// For ConnectionStatsGetter, used by ConnectionMonitor
- virtual bool GetConnectionStats(ConnectionInfos* infos) override;
+ bool GetConnectionStats(ConnectionInfos* infos) override;
void set_srtp_signal_silent_time(uint32 silent_time) {
srtp_filter_.set_signal_silent_time(silent_time);
@@ -167,19 +174,17 @@ class BaseChannel
sigslot::repeater2<BaseChannel*, bool> SignalAutoMuted;
// Made public for easier testing.
- void SetReadyToSend(TransportChannel* channel, bool ready);
+ void SetReadyToSend(bool rtcp, bool ready);
// Only public for unit tests. Otherwise, consider protected.
virtual int SetOption(SocketType type, rtc::Socket::Option o, int val);
protected:
virtual MediaChannel* media_channel() const { return media_channel_; }
- // Sets the transport_channel_ and rtcp_transport_channel_. If
- // |rtcp| is false, set rtcp_transport_channel_ is set to NULL. Get
- // the transport channels from |session|.
- // TODO(pthatcher): Pass in a Transport instead of a BaseSession.
- bool SetTransportChannels(BaseSession* session, bool rtcp);
- bool SetTransportChannels_w(BaseSession* session, bool rtcp);
+ // Sets the transport_channel_ (and rtcp_transport_channel_, if |rtcp_| is
+ // true). Gets the transport channels from |transport_controller_|.
+ bool SetTransportChannels(const std::string& transport_name);
+ bool SetTransportChannels_w(const std::string& transport_name);
void set_transport_channel(TransportChannel* transport);
void set_rtcp_transport_channel(TransportChannel* transport);
bool was_ever_writable() const { return was_ever_writable_; }
@@ -194,9 +199,11 @@ class BaseChannel
}
bool IsReadyToReceive() const;
bool IsReadyToSend() const;
- rtc::Thread* signaling_thread() { return session_->signaling_thread(); }
+ rtc::Thread* signaling_thread() {
+ return transport_controller_->signaling_thread();
+ }
SrtpFilter* srtp_filter() { return &srtp_filter_; }
- bool rtcp() const { return rtcp_; }
+ bool rtcp_transport_enabled() const { return rtcp_transport_enabled_; }
void ConnectToTransportChannel(TransportChannel* tc);
void DisconnectFromTransportChannel(TransportChannel* tc);
@@ -226,14 +233,11 @@ class BaseChannel
void HandlePacket(bool rtcp, rtc::Buffer* packet,
const rtc::PacketTime& packet_time);
- // Apply the new local/remote session description.
- void OnNewLocalDescription(BaseSession* session, ContentAction action);
- void OnNewRemoteDescription(BaseSession* session, ContentAction action);
-
void EnableMedia_w();
void DisableMedia_w();
virtual bool MuteStream_w(uint32 ssrc, bool mute);
bool IsStreamMuted_w(uint32 ssrc);
+ void UpdateWritableState_w();
void ChannelWritable_w();
void ChannelNotWritable_w();
bool AddRecvStream_w(const StreamParams& sp);
@@ -304,15 +308,18 @@ class BaseChannel
private:
rtc::Thread* worker_thread_;
- BaseSession* session_;
+ TransportController* transport_controller_;
MediaChannel* media_channel_;
std::vector<StreamParams> local_streams_;
std::vector<StreamParams> remote_streams_;
const std::string content_name_;
- bool rtcp_;
+ std::string transport_name_;
+ bool rtcp_transport_enabled_;
TransportChannel* transport_channel_;
+ std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
TransportChannel* rtcp_transport_channel_;
+ std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
SrtpFilter srtp_filter_;
RtcpMuxFilter rtcp_mux_filter_;
BundleFilter bundle_filter_;
@@ -335,9 +342,12 @@ class BaseChannel
// and input/output level monitoring.
class VoiceChannel : public BaseChannel {
public:
- VoiceChannel(rtc::Thread* thread, MediaEngineInterface* media_engine,
- VoiceMediaChannel* channel, BaseSession* session,
- const std::string& content_name, bool rtcp);
+ VoiceChannel(rtc::Thread* thread,
+ MediaEngineInterface* media_engine,
+ VoiceMediaChannel* channel,
+ TransportController* transport_controller,
+ const std::string& content_name,
+ bool rtcp);
~VoiceChannel();
bool Init();
bool SetRemoteRenderer(uint32 ssrc, AudioRenderer* renderer);
@@ -452,8 +462,10 @@ class VoiceChannel : public BaseChannel {
// VideoChannel is a specialization for video.
class VideoChannel : public BaseChannel {
public:
- VideoChannel(rtc::Thread* thread, VideoMediaChannel* channel,
- BaseSession* session, const std::string& content_name,
+ VideoChannel(rtc::Thread* thread,
+ VideoMediaChannel* channel,
+ TransportController* transport_controller,
+ const std::string& content_name,
bool rtcp);
~VideoChannel();
bool Init();
@@ -551,7 +563,7 @@ class DataChannel : public BaseChannel {
public:
DataChannel(rtc::Thread* thread,
DataMediaChannel* media_channel,
- BaseSession* session,
+ TransportController* transport_controller,
const std::string& content_name,
bool rtcp);
~DataChannel();

Powered by Google App Engine
This is Rietveld 408576698