| Index: webrtc/pc/channel.h
|
| diff --git a/webrtc/pc/channel.h b/webrtc/pc/channel.h
|
| index 4518301d3b65e9e6fdf89586d258b519e42a4677..bbaad2a2368e1bf9a9a8ee415864aa657a3847f4 100644
|
| --- a/webrtc/pc/channel.h
|
| +++ b/webrtc/pc/channel.h
|
| @@ -47,11 +47,6 @@ namespace cricket {
|
| struct CryptoParams;
|
| class MediaContentDescription;
|
|
|
| -enum SinkType {
|
| - SINK_PRE_CRYPTO, // Sink packets before encryption or after decryption.
|
| - SINK_POST_CRYPTO // Sink packets after encryption or before decryption.
|
| -};
|
| -
|
| // BaseChannel contains logic common to voice and video, including
|
| // enable, marshaling calls to a worker thread, and
|
| // connection and media monitors.
|
| @@ -66,7 +61,8 @@ class BaseChannel
|
| public MediaChannel::NetworkInterface,
|
| public ConnectionStatsGetter {
|
| public:
|
| - BaseChannel(rtc::Thread* thread,
|
| + BaseChannel(rtc::Thread* worker_thread,
|
| + rtc::Thread* network_thread,
|
| MediaChannel* channel,
|
| TransportController* transport_controller,
|
| const std::string& content_name,
|
| @@ -78,6 +74,7 @@ class BaseChannel
|
| void Deinit();
|
|
|
| rtc::Thread* worker_thread() const { return worker_thread_; }
|
| + rtc::Thread* network_thread() const { return network_thread_; }
|
| const std::string& content_name() const { return content_name_; }
|
| const std::string& transport_name() const { return transport_name_; }
|
| TransportChannel* transport_channel() const {
|
| @@ -143,14 +140,14 @@ class BaseChannel
|
| }
|
|
|
| sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure;
|
| - void SignalDtlsSetupFailure_w(bool rtcp);
|
| + void SignalDtlsSetupFailure_n(bool rtcp);
|
| void SignalDtlsSetupFailure_s(bool rtcp);
|
|
|
| // Used for latency measurements.
|
| sigslot::signal1<BaseChannel*> SignalFirstPacketReceived;
|
|
|
| // Made public for easier testing.
|
| - void SetReadyToSend(bool rtcp, bool ready);
|
| + void SetReadyToSend_n(bool rtcp, bool ready);
|
|
|
| // Only public for unit tests. Otherwise, consider protected.
|
| int SetOption(SocketType type, rtc::Socket::Option o, int val)
|
| @@ -158,14 +155,19 @@ class BaseChannel
|
|
|
| SrtpFilter* srtp_filter() { return &srtp_filter_; }
|
|
|
| + bool SetRtpTransportParameters_n(const MediaContentDescription* content,
|
| + ContentAction action,
|
| + ContentSource src,
|
| + std::string* error_desc);
|
| +
|
| protected:
|
| virtual MediaChannel* media_channel() const { return media_channel_; }
|
| // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is
|
| // true). Gets the transport channels from |transport_controller_|.
|
| - bool SetTransport_w(const std::string& transport_name);
|
| + bool SetTransport_n(const std::string& transport_name);
|
|
|
| - void set_transport_channel(TransportChannel* transport);
|
| - void set_rtcp_transport_channel(TransportChannel* transport,
|
| + void set_transport_channel(const std::string& transport_name);
|
| + void set_rtcp_transport_channel(const std::string* transport_name,
|
| bool update_writablity);
|
|
|
| bool was_ever_writable() const { return was_ever_writable_; }
|
| @@ -217,15 +219,17 @@ class BaseChannel
|
| bool SendPacket(bool rtcp,
|
| rtc::CopyOnWriteBuffer* packet,
|
| const rtc::PacketOptions& options);
|
| +
|
| virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet);
|
| - void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet,
|
| + void HandlePacket(bool rtcp,
|
| + rtc::CopyOnWriteBuffer* packet,
|
| const rtc::PacketTime& packet_time);
|
|
|
| void EnableMedia_w();
|
| void DisableMedia_w();
|
| - void UpdateWritableState_w();
|
| - void ChannelWritable_w();
|
| - void ChannelNotWritable_w();
|
| + void UpdateWritableState_n();
|
| + void ChannelWritable_n();
|
| + void ChannelNotWritable_n();
|
| bool AddRecvStream_w(const StreamParams& sp);
|
| bool RemoveRecvStream_w(uint32_t ssrc);
|
| bool AddSendStream_w(const StreamParams& sp);
|
| @@ -233,12 +237,13 @@ class BaseChannel
|
| virtual bool ShouldSetupDtlsSrtp() const;
|
| // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters.
|
| // |rtcp_channel| indicates whether to set up the RTP or RTCP filter.
|
| - bool SetupDtlsSrtp(bool rtcp_channel);
|
| - void MaybeSetupDtlsSrtp_w();
|
| + bool SetupDtlsSrtp_n(bool rtcp_channel);
|
| + void MaybeSetupDtlsSrtp_n();
|
| // Set the DTLS-SRTP cipher policy on this channel as appropriate.
|
| bool SetDtlsSrtpCryptoSuites(TransportChannel* tc, bool rtcp);
|
|
|
| - virtual void ChangeState() = 0;
|
| + void ChangeState_n();
|
| + virtual void ChangeState_w() = 0;
|
|
|
| // Gets the content info appropriate to the channel (audio or video).
|
| virtual const ContentInfo* GetFirstContent(
|
| @@ -255,10 +260,6 @@ class BaseChannel
|
| virtual bool SetRemoteContent_w(const MediaContentDescription* content,
|
| ContentAction action,
|
| std::string* error_desc) = 0;
|
| - bool SetRtpTransportParameters_w(const MediaContentDescription* content,
|
| - ContentAction action,
|
| - ContentSource src,
|
| - std::string* error_desc);
|
|
|
| // Helper method to get RTP Absoulute SendTime extension header id if
|
| // present in remote supported extensions list.
|
| @@ -268,12 +269,12 @@ class BaseChannel
|
| bool CheckSrtpConfig(const std::vector<CryptoParams>& cryptos,
|
| bool* dtls,
|
| std::string* error_desc);
|
| - bool SetSrtp_w(const std::vector<CryptoParams>& params,
|
| + bool SetSrtp_n(const std::vector<CryptoParams>& params,
|
| ContentAction action,
|
| ContentSource src,
|
| std::string* error_desc);
|
| - void ActivateRtcpMux_w();
|
| - bool SetRtcpMux_w(bool enable,
|
| + void ActivateRtcpMux_n();
|
| + bool SetRtcpMux_n(bool enable,
|
| ContentAction action,
|
| ContentSource src,
|
| std::string* error_desc);
|
| @@ -292,9 +293,14 @@ class BaseChannel
|
| bool InvokeOnWorker(const FunctorT& functor) {
|
| return worker_thread_->Invoke<bool>(functor);
|
| }
|
| + template <class FunctorT>
|
| + bool InvokeOnNetwork(const FunctorT& functor) {
|
| + return network_thread_->Invoke<bool>(functor);
|
| + }
|
|
|
| private:
|
| rtc::Thread* worker_thread_;
|
| + rtc::Thread* network_thread_;
|
| TransportController* transport_controller_;
|
| MediaChannel* media_channel_;
|
| std::vector<StreamParams> local_streams_;
|
| @@ -328,7 +334,8 @@ class BaseChannel
|
| // and input/output level monitoring.
|
| class VoiceChannel : public BaseChannel {
|
| public:
|
| - VoiceChannel(rtc::Thread* thread,
|
| + VoiceChannel(rtc::Thread* worker_thread,
|
| + rtc::Thread* network_thread,
|
| MediaEngineInterface* media_engine,
|
| VoiceMediaChannel* channel,
|
| TransportController* transport_controller,
|
| @@ -397,7 +404,7 @@ class VoiceChannel : public BaseChannel {
|
| const char* data, size_t len,
|
| const rtc::PacketTime& packet_time,
|
| int flags);
|
| - virtual void ChangeState();
|
| + void ChangeState_w() override;
|
| virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc);
|
| virtual bool SetLocalContent_w(const MediaContentDescription* content,
|
| ContentAction action,
|
| @@ -435,7 +442,8 @@ class VoiceChannel : public BaseChannel {
|
| // VideoChannel is a specialization for video.
|
| class VideoChannel : public BaseChannel {
|
| public:
|
| - VideoChannel(rtc::Thread* thread,
|
| + VideoChannel(rtc::Thread* worker_thread,
|
| + rtc::Thread* netwokr_thread,
|
| VideoMediaChannel* channel,
|
| TransportController* transport_controller,
|
| const std::string& content_name,
|
| @@ -469,7 +477,7 @@ class VideoChannel : public BaseChannel {
|
|
|
| private:
|
| // overrides from BaseChannel
|
| - virtual void ChangeState();
|
| + void ChangeState_w() override;
|
| virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc);
|
| virtual bool SetLocalContent_w(const MediaContentDescription* content,
|
| ContentAction action,
|
| @@ -501,7 +509,8 @@ class VideoChannel : public BaseChannel {
|
| // DataChannel is a specialization for data.
|
| class DataChannel : public BaseChannel {
|
| public:
|
| - DataChannel(rtc::Thread* thread,
|
| + DataChannel(rtc::Thread* worker_thread,
|
| + rtc::Thread* network_thread,
|
| DataMediaChannel* media_channel,
|
| TransportController* transport_controller,
|
| const std::string& content_name,
|
| @@ -588,8 +597,8 @@ class DataChannel : public BaseChannel {
|
| virtual bool SetRemoteContent_w(const MediaContentDescription* content,
|
| ContentAction action,
|
| std::string* error_desc);
|
| - virtual void ChangeState();
|
| - virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet);
|
| + void ChangeState_w() override;
|
| + bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet) override;
|
|
|
| virtual void OnMessage(rtc::Message* pmsg);
|
| virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const;
|
|
|