blob: 6ea54194fbb8bf908cfd9d2e52f6ed76f0a7819e [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:361/*
kjellander65c7f672016-02-12 08:05:012 * Copyright 2004 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:363 *
kjellander65c7f672016-02-12 08:05:014 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:369 */
10
perkjc11b1842016-03-08 01:34:1311#ifndef WEBRTC_PC_CHANNEL_H_
12#define WEBRTC_PC_CHANNEL_H_
henrike@webrtc.org28e20752013-07-10 00:45:3613
deadbeefcbecd352015-09-23 18:50:2714#include <map>
kwiberg31022942016-03-11 22:18:2115#include <memory>
deadbeefcbecd352015-09-23 18:50:2716#include <set>
kjellandera96e2d72016-02-05 07:52:2817#include <string>
deadbeefcbecd352015-09-23 18:50:2718#include <utility>
kjellandera96e2d72016-02-05 07:52:2819#include <vector>
henrike@webrtc.org28e20752013-07-10 00:45:3620
kjellandera69d9732016-08-31 14:33:0521#include "webrtc/api/call/audio_sink.h"
Danil Chapovalov33b01f22016-05-11 17:55:2722#include "webrtc/base/asyncinvoker.h"
buildbot@webrtc.orga09a9992014-08-13 17:26:0823#include "webrtc/base/asyncudpsocket.h"
24#include "webrtc/base/criticalsection.h"
25#include "webrtc/base/network.h"
26#include "webrtc/base/sigslot.h"
27#include "webrtc/base/window.h"
kjellandera96e2d72016-02-05 07:52:2828#include "webrtc/media/base/mediachannel.h"
29#include "webrtc/media/base/mediaengine.h"
30#include "webrtc/media/base/streamparams.h"
nisse08582ff2016-02-04 09:24:5231#include "webrtc/media/base/videosinkinterface.h"
nisse2ded9b12016-04-08 09:23:5532#include "webrtc/media/base/videosourceinterface.h"
Tommif888bb52015-12-12 00:37:0133#include "webrtc/p2p/base/transportcontroller.h"
34#include "webrtc/p2p/client/socketmonitor.h"
kjellander@webrtc.org9b8df252016-02-12 05:47:5935#include "webrtc/pc/audiomonitor.h"
36#include "webrtc/pc/bundlefilter.h"
37#include "webrtc/pc/mediamonitor.h"
38#include "webrtc/pc/mediasession.h"
39#include "webrtc/pc/rtcpmuxfilter.h"
40#include "webrtc/pc/srtpfilter.h"
Tommif888bb52015-12-12 00:37:0141
42namespace webrtc {
43class AudioSinkInterface;
44} // namespace webrtc
henrike@webrtc.org28e20752013-07-10 00:45:3645
46namespace cricket {
47
48struct CryptoParams;
49class MediaContentDescription;
henrike@webrtc.org28e20752013-07-10 00:45:3650
deadbeef062ce9f2016-08-27 04:42:1551// BaseChannel contains logic common to voice and video, including enable,
52// marshaling calls to a worker and network threads, and connection and media
53// monitors.
54//
Danil Chapovalov33b01f22016-05-11 17:55:2755// BaseChannel assumes signaling and other threads are allowed to make
56// synchronous calls to the worker thread, the worker thread makes synchronous
57// calls only to the network thread, and the network thread can't be blocked by
58// other threads.
59// All methods with _n suffix must be called on network thread,
deadbeef062ce9f2016-08-27 04:42:1560// methods with _w suffix on worker thread
Danil Chapovalov33b01f22016-05-11 17:55:2761// and methods with _s suffix on signaling thread.
62// Network and worker threads may be the same thread.
wu@webrtc.org78187522013-10-07 23:32:0263//
64// WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS!
65// This is required to avoid a data race between the destructor modifying the
66// vtable, and the media channel's thread using BaseChannel as the
67// NetworkInterface.
68
henrike@webrtc.org28e20752013-07-10 00:45:3669class BaseChannel
buildbot@webrtc.orgd4e598d2014-07-29 17:36:5270 : public rtc::MessageHandler, public sigslot::has_slots<>,
pthatcher@webrtc.orgb4aac132015-03-13 18:25:2171 public MediaChannel::NetworkInterface,
72 public ConnectionStatsGetter {
henrike@webrtc.org28e20752013-07-10 00:45:3673 public:
deadbeef23d947d2016-08-22 23:00:3074 // |rtcp| represents whether or not this channel uses RTCP.
Danil Chapovalov33b01f22016-05-11 17:55:2775 BaseChannel(rtc::Thread* worker_thread,
76 rtc::Thread* network_thread,
deadbeefcbecd352015-09-23 18:50:2777 MediaChannel* channel,
78 TransportController* transport_controller,
79 const std::string& content_name,
80 bool rtcp);
henrike@webrtc.org28e20752013-07-10 00:45:3681 virtual ~BaseChannel();
skvlad6c87a672016-05-18 00:49:5282 bool Init_w(const std::string* bundle_transport_name);
Danil Chapovalov33b01f22016-05-11 17:55:2783 // Deinit may be called multiple times and is simply ignored if it's already
wu@webrtc.org78187522013-10-07 23:32:0284 // done.
85 void Deinit();
henrike@webrtc.org28e20752013-07-10 00:45:3686
buildbot@webrtc.orgd4e598d2014-07-29 17:36:5287 rtc::Thread* worker_thread() const { return worker_thread_; }
Danil Chapovalov33b01f22016-05-11 17:55:2788 rtc::Thread* network_thread() const { return network_thread_; }
deadbeefcbecd352015-09-23 18:50:2789 const std::string& content_name() const { return content_name_; }
90 const std::string& transport_name() const { return transport_name_; }
henrike@webrtc.org28e20752013-07-10 00:45:3691 bool enabled() const { return enabled_; }
henrike@webrtc.org28e20752013-07-10 00:45:3692
93 // This function returns true if we are using SRTP.
94 bool secure() const { return srtp_filter_.IsActive(); }
95 // The following function returns true if we are using
96 // DTLS-based keying. If you turned off SRTP later, however
97 // you could have secure() == false and dtls_secure() == true.
98 bool secure_dtls() const { return dtls_keyed_; }
99 // This function returns true if we require secure channel for call setup.
100 bool secure_required() const { return secure_required_; }
101
102 bool writable() const { return writable_; }
henrike@webrtc.org28e20752013-07-10 00:45:36103
Peter Thatcheraf55ccc2015-05-21 14:48:41104 // Activate RTCP mux, regardless of the state so far. Once
105 // activated, it can not be deactivated, and if the remote
106 // description doesn't support RTCP mux, setting the remote
107 // description will fail.
108 void ActivateRtcpMux();
deadbeefcbecd352015-09-23 18:50:27109 bool SetTransport(const std::string& transport_name);
pthatcher@webrtc.org592470b2015-03-16 21:15:37110 bool PushdownLocalDescription(const SessionDescription* local_desc,
111 ContentAction action,
112 std::string* error_desc);
113 bool PushdownRemoteDescription(const SessionDescription* remote_desc,
114 ContentAction action,
115 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36116 // Channel control
117 bool SetLocalContent(const MediaContentDescription* content,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54118 ContentAction action,
119 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36120 bool SetRemoteContent(const MediaContentDescription* content,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54121 ContentAction action,
122 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36123
124 bool Enable(bool enable);
henrike@webrtc.org28e20752013-07-10 00:45:36125
126 // Multiplexing
127 bool AddRecvStream(const StreamParams& sp);
Peter Boström0c4e06b2015-10-07 10:23:21128 bool RemoveRecvStream(uint32_t ssrc);
wu@webrtc.orgcadf9042013-08-30 21:24:16129 bool AddSendStream(const StreamParams& sp);
Peter Boström0c4e06b2015-10-07 10:23:21130 bool RemoveSendStream(uint32_t ssrc);
henrike@webrtc.org28e20752013-07-10 00:45:36131
132 // Monitoring
133 void StartConnectionMonitor(int cms);
134 void StopConnectionMonitor();
pthatcher@webrtc.orgb4aac132015-03-13 18:25:21135 // For ConnectionStatsGetter, used by ConnectionMonitor
deadbeefcbecd352015-09-23 18:50:27136 bool GetConnectionStats(ConnectionInfos* infos) override;
henrike@webrtc.org28e20752013-07-10 00:45:36137
buildbot@webrtc.org5ee0f052014-05-05 20:18:08138 BundleFilter* bundle_filter() { return &bundle_filter_; }
henrike@webrtc.org28e20752013-07-10 00:45:36139
140 const std::vector<StreamParams>& local_streams() const {
141 return local_streams_;
142 }
143 const std::vector<StreamParams>& remote_streams() const {
144 return remote_streams_;
145 }
146
pthatcher@webrtc.org4eeef582015-03-16 19:34:23147 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure;
Danil Chapovalov33b01f22016-05-11 17:55:27148 void SignalDtlsSetupFailure_n(bool rtcp);
pthatcher@webrtc.org4eeef582015-03-16 19:34:23149 void SignalDtlsSetupFailure_s(bool rtcp);
150
buildbot@webrtc.org6bfd6192014-05-15 16:15:59151 // Used for latency measurements.
henrike@webrtc.org28e20752013-07-10 00:45:36152 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived;
153
Danil Chapovalov33b01f22016-05-11 17:55:27154 // Forward TransportChannel SignalSentPacket to worker thread.
155 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket;
156
157 // Only public for unit tests. Otherwise, consider private.
158 TransportChannel* transport_channel() const { return transport_channel_; }
159 TransportChannel* rtcp_transport_channel() const {
160 return rtcp_transport_channel_;
161 }
162
henrike@webrtc.org28e20752013-07-10 00:45:36163 // Made public for easier testing.
Taylor Brandstetterbad33bf2016-08-25 20:31:14164 //
165 // Updates "ready to send" for an individual channel, and informs the media
166 // channel that the transport is ready to send if each channel (in use) is
167 // ready to send. This is more specific than just "writable"; it means the
168 // last send didn't return ENOTCONN.
169 //
170 // This should be called whenever a channel's ready-to-send state changes,
171 // or when RTCP muxing becomes active/inactive.
172 void SetTransportChannelReadyToSend(bool rtcp, bool ready);
henrike@webrtc.org28e20752013-07-10 00:45:36173
guoweis@webrtc.org4f852882015-03-12 20:09:44174 // Only public for unit tests. Otherwise, consider protected.
rlesterec9d1872015-10-27 21:22:16175 int SetOption(SocketType type, rtc::Socket::Option o, int val)
176 override;
Danil Chapovalov33b01f22016-05-11 17:55:27177 int SetOption_n(SocketType type, rtc::Socket::Option o, int val);
guoweis@webrtc.org4f852882015-03-12 20:09:44178
solenberg5b14b422015-10-01 11:10:31179 SrtpFilter* srtp_filter() { return &srtp_filter_; }
180
zhihuang184a3fd2016-06-14 18:47:14181 virtual cricket::MediaType media_type() = 0;
182
jbauchcb560652016-08-04 12:20:32183 bool SetCryptoOptions(const rtc::CryptoOptions& crypto_options);
184
henrike@webrtc.org28e20752013-07-10 00:45:36185 protected:
henrike@webrtc.org28e20752013-07-10 00:45:36186 virtual MediaChannel* media_channel() const { return media_channel_; }
Taylor Brandstetterbad33bf2016-08-25 20:31:14187
188 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if
189 // |rtcp_enabled_| is true). Gets the transport channels from
190 // |transport_controller_|.
deadbeef062ce9f2016-08-27 04:42:15191 // This method also updates writability and "ready-to-send" state.
Danil Chapovalov33b01f22016-05-11 17:55:27192 bool SetTransport_n(const std::string& transport_name);
guoweis46383312015-12-18 00:45:59193
deadbeef062ce9f2016-08-27 04:42:15194 // This does not update writability or "ready-to-send" state; it just
195 // disconnects from the old channel and connects to the new one.
196 void SetTransportChannel_n(bool rtcp, TransportChannel* new_channel);
guoweis46383312015-12-18 00:45:59197
henrike@webrtc.org28e20752013-07-10 00:45:36198 bool was_ever_writable() const { return was_ever_writable_; }
199 void set_local_content_direction(MediaContentDirection direction) {
200 local_content_direction_ = direction;
201 }
202 void set_remote_content_direction(MediaContentDirection direction) {
203 remote_content_direction_ = direction;
204 }
Peter Thatcherc2ee2c82015-08-07 23:05:34205 void set_secure_required(bool secure_required) {
206 secure_required_ = secure_required;
207 }
Taylor Brandstetterbad33bf2016-08-25 20:31:14208 // These methods verify that:
209 // * The required content description directions have been set.
210 // * The channel is enabled.
211 // * And for sending:
212 // - The SRTP filter is active if it's needed.
213 // - The transport has been writable before, meaning it should be at least
214 // possible to succeed in sending a packet.
215 //
216 // When any of these properties change, UpdateMediaSendRecvState_w should be
217 // called.
218 bool IsReadyToReceiveMedia_w() const;
219 bool IsReadyToSendMedia_w() const;
deadbeefcbecd352015-09-23 18:50:27220 rtc::Thread* signaling_thread() {
221 return transport_controller_->signaling_thread();
222 }
henrike@webrtc.org28e20752013-07-10 00:45:36223
pthatcher@webrtc.org6ad507a2015-03-16 20:19:12224 void ConnectToTransportChannel(TransportChannel* tc);
225 void DisconnectFromTransportChannel(TransportChannel* tc);
226
Danil Chapovalov33b01f22016-05-11 17:55:27227 void FlushRtcpMessages_n();
henrike@webrtc.org28e20752013-07-10 00:45:36228
229 // NetworkInterface implementation, called by MediaEngine
jbaucheec21bd2016-03-20 13:15:43230 bool SendPacket(rtc::CopyOnWriteBuffer* packet,
231 const rtc::PacketOptions& options) override;
232 bool SendRtcp(rtc::CopyOnWriteBuffer* packet,
233 const rtc::PacketOptions& options) override;
henrike@webrtc.org28e20752013-07-10 00:45:36234
235 // From TransportChannel
236 void OnWritableState(TransportChannel* channel);
wu@webrtc.orga9890802013-12-13 00:21:03237 virtual void OnChannelRead(TransportChannel* channel,
238 const char* data,
239 size_t len,
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52240 const rtc::PacketTime& packet_time,
wu@webrtc.orga9890802013-12-13 00:21:03241 int flags);
henrike@webrtc.org28e20752013-07-10 00:45:36242 void OnReadyToSend(TransportChannel* channel);
243
Guo-wei Shieh1218d7a2015-12-05 17:59:56244 void OnDtlsState(TransportChannel* channel, DtlsTransportState state);
245
Honghai Zhangcc411c02016-03-30 00:27:21246 void OnSelectedCandidatePairChanged(
247 TransportChannel* channel,
Honghai Zhang52dce73f2016-03-31 19:37:31248 CandidatePairInterface* selected_candidate_pair,
Taylor Brandstetter6bb1ef22016-06-28 01:09:03249 int last_sent_packet_id,
250 bool ready_to_send);
Honghai Zhangcc411c02016-03-30 00:27:21251
henrike@webrtc.org28e20752013-07-10 00:45:36252 bool PacketIsRtcp(const TransportChannel* channel, const char* data,
253 size_t len);
stefanc1aeaf02015-10-15 14:26:07254 bool SendPacket(bool rtcp,
jbaucheec21bd2016-03-20 13:15:43255 rtc::CopyOnWriteBuffer* packet,
stefanc1aeaf02015-10-15 14:26:07256 const rtc::PacketOptions& options);
Danil Chapovalov33b01f22016-05-11 17:55:27257
jbaucheec21bd2016-03-20 13:15:43258 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet);
259 void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet,
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52260 const rtc::PacketTime& packet_time);
Danil Chapovalov33b01f22016-05-11 17:55:27261 void OnPacketReceived(bool rtcp,
262 const rtc::CopyOnWriteBuffer& packet,
263 const rtc::PacketTime& packet_time);
henrike@webrtc.org28e20752013-07-10 00:45:36264
henrike@webrtc.org28e20752013-07-10 00:45:36265 void EnableMedia_w();
266 void DisableMedia_w();
Taylor Brandstetterbad33bf2016-08-25 20:31:14267
268 // Performs actions if the RTP/RTCP writable state changed. This should
269 // be called whenever a channel's writable state changes or when RTCP muxing
270 // becomes active/inactive.
Danil Chapovalov33b01f22016-05-11 17:55:27271 void UpdateWritableState_n();
272 void ChannelWritable_n();
273 void ChannelNotWritable_n();
Taylor Brandstetterbad33bf2016-08-25 20:31:14274
henrike@webrtc.org28e20752013-07-10 00:45:36275 bool AddRecvStream_w(const StreamParams& sp);
Peter Boström0c4e06b2015-10-07 10:23:21276 bool RemoveRecvStream_w(uint32_t ssrc);
wu@webrtc.orgcadf9042013-08-30 21:24:16277 bool AddSendStream_w(const StreamParams& sp);
Peter Boström0c4e06b2015-10-07 10:23:21278 bool RemoveSendStream_w(uint32_t ssrc);
Danil Chapovalov33b01f22016-05-11 17:55:27279 virtual bool ShouldSetupDtlsSrtp_n() const;
henrike@webrtc.org28e20752013-07-10 00:45:36280 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters.
281 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter.
Danil Chapovalov33b01f22016-05-11 17:55:27282 bool SetupDtlsSrtp_n(bool rtcp_channel);
283 void MaybeSetupDtlsSrtp_n();
henrike@webrtc.org28e20752013-07-10 00:45:36284 // Set the DTLS-SRTP cipher policy on this channel as appropriate.
Danil Chapovalov33b01f22016-05-11 17:55:27285 bool SetDtlsSrtpCryptoSuites_n(TransportChannel* tc, bool rtcp);
henrike@webrtc.org28e20752013-07-10 00:45:36286
Taylor Brandstetterbad33bf2016-08-25 20:31:14287 // Should be called whenever the conditions for
288 // IsReadyToReceiveMedia/IsReadyToSendMedia are satisfied (or unsatisfied).
289 // Updates the send/recv state of the media channel.
290 void UpdateMediaSendRecvState();
291 virtual void UpdateMediaSendRecvState_w() = 0;
henrike@webrtc.org28e20752013-07-10 00:45:36292
293 // Gets the content info appropriate to the channel (audio or video).
294 virtual const ContentInfo* GetFirstContent(
295 const SessionDescription* sdesc) = 0;
296 bool UpdateLocalStreams_w(const std::vector<StreamParams>& streams,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54297 ContentAction action,
298 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36299 bool UpdateRemoteStreams_w(const std::vector<StreamParams>& streams,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54300 ContentAction action,
301 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36302 virtual bool SetLocalContent_w(const MediaContentDescription* content,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54303 ContentAction action,
304 std::string* error_desc) = 0;
henrike@webrtc.org28e20752013-07-10 00:45:36305 virtual bool SetRemoteContent_w(const MediaContentDescription* content,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54306 ContentAction action,
307 std::string* error_desc) = 0;
Danil Chapovalov33b01f22016-05-11 17:55:27308 bool SetRtpTransportParameters(const MediaContentDescription* content,
309 ContentAction action,
310 ContentSource src,
311 std::string* error_desc);
312 bool SetRtpTransportParameters_n(const MediaContentDescription* content,
Peter Thatcherc2ee2c82015-08-07 23:05:34313 ContentAction action,
314 ContentSource src,
315 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36316
henrike@webrtc.orgd43aa9d2014-02-21 23:43:24317 // Helper method to get RTP Absoulute SendTime extension header id if
318 // present in remote supported extensions list.
Danil Chapovalov33b01f22016-05-11 17:55:27319 void MaybeCacheRtpAbsSendTimeHeaderExtension_w(
isheriff6f8d6862016-05-26 18:24:55320 const std::vector<webrtc::RtpExtension>& extensions);
henrike@webrtc.orgd43aa9d2014-02-21 23:43:24321
Danil Chapovalov33b01f22016-05-11 17:55:27322 bool CheckSrtpConfig_n(const std::vector<CryptoParams>& cryptos,
323 bool* dtls,
324 std::string* error_desc);
325 bool SetSrtp_n(const std::vector<CryptoParams>& params,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54326 ContentAction action,
327 ContentSource src,
328 std::string* error_desc);
Danil Chapovalov33b01f22016-05-11 17:55:27329 void ActivateRtcpMux_n();
330 bool SetRtcpMux_n(bool enable,
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54331 ContentAction action,
332 ContentSource src,
333 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36334
335 // From MessageHandler
rlesterec9d1872015-10-27 21:22:16336 void OnMessage(rtc::Message* pmsg) override;
henrike@webrtc.org28e20752013-07-10 00:45:36337
jbauchcb560652016-08-04 12:20:32338 const rtc::CryptoOptions& crypto_options() const {
339 return crypto_options_;
340 }
341
henrike@webrtc.org28e20752013-07-10 00:45:36342 // Handled in derived classes
Guo-wei Shieh521ed7b2015-11-19 03:41:53343 // Get the SRTP crypto suites to use for RTP media
Danil Chapovalov33b01f22016-05-11 17:55:27344 virtual void GetSrtpCryptoSuites_n(std::vector<int>* crypto_suites) const = 0;
pthatcher@webrtc.orgb4aac132015-03-13 18:25:21345 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor,
henrike@webrtc.org28e20752013-07-10 00:45:36346 const std::vector<ConnectionInfo>& infos) = 0;
347
sergeyu@chromium.org9cf037b2014-02-07 19:03:26348 // Helper function for invoking bool-returning methods on the worker thread.
349 template <class FunctorT>
Taylor Brandstetter5d97a9a2016-06-10 21:17:27350 bool InvokeOnWorker(const rtc::Location& posted_from,
351 const FunctorT& functor) {
352 return worker_thread_->Invoke<bool>(posted_from, functor);
sergeyu@chromium.org9cf037b2014-02-07 19:03:26353 }
354
henrike@webrtc.org28e20752013-07-10 00:45:36355 private:
skvlad6c87a672016-05-18 00:49:52356 bool InitNetwork_n(const std::string* bundle_transport_name);
Danil Chapovalovdae07ba2016-05-13 23:43:50357 void DisconnectTransportChannels_n();
358 void DestroyTransportChannels_n();
Danil Chapovalov33b01f22016-05-11 17:55:27359 void SignalSentPacket_n(TransportChannel* channel,
360 const rtc::SentPacket& sent_packet);
361 void SignalSentPacket_w(const rtc::SentPacket& sent_packet);
Taylor Brandstetterbad33bf2016-08-25 20:31:14362 bool IsReadyToSendMedia_n() const;
Danil Chapovalov33b01f22016-05-11 17:55:27363 void CacheRtpAbsSendTimeHeaderExtension_n(int rtp_abs_sendtime_extn_id);
364
365 rtc::Thread* const worker_thread_;
366 rtc::Thread* const network_thread_;
367 rtc::AsyncInvoker invoker_;
henrike@webrtc.org28e20752013-07-10 00:45:36368
pthatcher@webrtc.org990a00c2015-03-13 18:20:33369 const std::string content_name_;
Danil Chapovalov33b01f22016-05-11 17:55:27370 std::unique_ptr<ConnectionMonitor> connection_monitor_;
371
372 // Transport related members that should be accessed from network thread.
373 TransportController* const transport_controller_;
deadbeefcbecd352015-09-23 18:50:27374 std::string transport_name_;
deadbeef23d947d2016-08-22 23:00:30375 // Is RTCP used at all by this type of channel?
376 // Expected to be true (as of typing this) for everything except data
377 // channels.
378 const bool rtcp_enabled_;
379 TransportChannel* transport_channel_ = nullptr;
deadbeefcbecd352015-09-23 18:50:27380 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
deadbeef23d947d2016-08-22 23:00:30381 TransportChannel* rtcp_transport_channel_ = nullptr;
deadbeefcbecd352015-09-23 18:50:27382 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
henrike@webrtc.org28e20752013-07-10 00:45:36383 SrtpFilter srtp_filter_;
384 RtcpMuxFilter rtcp_mux_filter_;
buildbot@webrtc.org5ee0f052014-05-05 20:18:08385 BundleFilter bundle_filter_;
deadbeef23d947d2016-08-22 23:00:30386 bool rtp_ready_to_send_ = false;
387 bool rtcp_ready_to_send_ = false;
388 bool writable_ = false;
389 bool was_ever_writable_ = false;
390 bool has_received_packet_ = false;
391 bool dtls_keyed_ = false;
392 bool secure_required_ = false;
jbauchcb560652016-08-04 12:20:32393 rtc::CryptoOptions crypto_options_;
deadbeef23d947d2016-08-22 23:00:30394 int rtp_abs_sendtime_extn_id_ = -1;
Danil Chapovalov33b01f22016-05-11 17:55:27395
Taylor Brandstetterbad33bf2016-08-25 20:31:14396 // MediaChannel related members that should be accessed from the worker
397 // thread.
Danil Chapovalov33b01f22016-05-11 17:55:27398 MediaChannel* const media_channel_;
Taylor Brandstetterbad33bf2016-08-25 20:31:14399 // Currently the |enabled_| flag is accessed from the signaling thread as
400 // well, but it can be changed only when signaling thread does a synchronous
401 // call to the worker thread, so it should be safe.
deadbeef23d947d2016-08-22 23:00:30402 bool enabled_ = false;
Danil Chapovalov33b01f22016-05-11 17:55:27403 std::vector<StreamParams> local_streams_;
404 std::vector<StreamParams> remote_streams_;
deadbeef23d947d2016-08-22 23:00:30405 MediaContentDirection local_content_direction_ = MD_INACTIVE;
406 MediaContentDirection remote_content_direction_ = MD_INACTIVE;
henrike@webrtc.org28e20752013-07-10 00:45:36407};
408
409// VoiceChannel is a specialization that adds support for early media, DTMF,
410// and input/output level monitoring.
411class VoiceChannel : public BaseChannel {
412 public:
Danil Chapovalov33b01f22016-05-11 17:55:27413 VoiceChannel(rtc::Thread* worker_thread,
414 rtc::Thread* network_thread,
deadbeefcbecd352015-09-23 18:50:27415 MediaEngineInterface* media_engine,
416 VoiceMediaChannel* channel,
417 TransportController* transport_controller,
418 const std::string& content_name,
419 bool rtcp);
henrike@webrtc.org28e20752013-07-10 00:45:36420 ~VoiceChannel();
skvlad6c87a672016-05-18 00:49:52421 bool Init_w(const std::string* bundle_transport_name);
solenberg1dd98f32015-09-10 08:57:14422
423 // Configure sending media on the stream with SSRC |ssrc|
424 // If there is only one sending stream SSRC 0 can be used.
Peter Boström0c4e06b2015-10-07 10:23:21425 bool SetAudioSend(uint32_t ssrc,
solenbergdfc8f4f2015-10-01 09:31:10426 bool enable,
deadbeefcbecd352015-09-23 18:50:27427 const AudioOptions* options,
Taylor Brandstetter1a018dc2016-03-08 20:37:39428 AudioSource* source);
henrike@webrtc.org28e20752013-07-10 00:45:36429
430 // downcasts a MediaChannel
Danil Chapovalov33b01f22016-05-11 17:55:27431 VoiceMediaChannel* media_channel() const override {
henrike@webrtc.org28e20752013-07-10 00:45:36432 return static_cast<VoiceMediaChannel*>(BaseChannel::media_channel());
433 }
434
henrike@webrtc.org28e20752013-07-10 00:45:36435 void SetEarlyMedia(bool enable);
436 // This signal is emitted when we have gone a period of time without
437 // receiving early media. When received, a UI should start playing its
438 // own ringing sound
439 sigslot::signal1<VoiceChannel*> SignalEarlyMediaTimeout;
440
henrike@webrtc.org28e20752013-07-10 00:45:36441 // Returns if the telephone-event has been negotiated.
442 bool CanInsertDtmf();
443 // Send and/or play a DTMF |event| according to the |flags|.
444 // The DTMF out-of-band signal will be used on sending.
445 // The |ssrc| should be either 0 or a valid send stream ssrc.
henrike@webrtc.org9de257d2013-07-17 14:42:53446 // The valid value for the |event| are 0 which corresponding to DTMF
447 // event 0-9, *, #, A-D.
solenberg1d63dd02015-12-02 20:35:09448 bool InsertDtmf(uint32_t ssrc, int event_code, int duration);
solenberg4bac9c52015-10-09 09:32:53449 bool SetOutputVolume(uint32_t ssrc, double volume);
deadbeef2d110be2016-01-13 20:00:26450 void SetRawAudioSink(uint32_t ssrc,
kwiberg31022942016-03-11 22:18:21451 std::unique_ptr<webrtc::AudioSinkInterface> sink);
Taylor Brandstetterdb0cd9e2016-05-16 18:40:30452 webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const;
453 bool SetRtpSendParameters(uint32_t ssrc,
454 const webrtc::RtpParameters& parameters);
455 webrtc::RtpParameters GetRtpReceiveParameters(uint32_t ssrc) const;
456 bool SetRtpReceiveParameters(uint32_t ssrc,
457 const webrtc::RtpParameters& parameters);
Tommif888bb52015-12-12 00:37:01458
henrike@webrtc.org28e20752013-07-10 00:45:36459 // Get statistics about the current media session.
460 bool GetStats(VoiceMediaInfo* stats);
461
462 // Monitoring functions
463 sigslot::signal2<VoiceChannel*, const std::vector<ConnectionInfo>&>
464 SignalConnectionMonitor;
465
466 void StartMediaMonitor(int cms);
467 void StopMediaMonitor();
468 sigslot::signal2<VoiceChannel*, const VoiceMediaInfo&> SignalMediaMonitor;
469
470 void StartAudioMonitor(int cms);
471 void StopAudioMonitor();
472 bool IsAudioMonitorRunning() const;
473 sigslot::signal2<VoiceChannel*, const AudioInfo&> SignalAudioMonitor;
474
henrike@webrtc.org28e20752013-07-10 00:45:36475 int GetInputLevel_w();
476 int GetOutputLevel_w();
477 void GetActiveStreams_w(AudioInfo::StreamList* actives);
Taylor Brandstetterdb0cd9e2016-05-16 18:40:30478 webrtc::RtpParameters GetRtpSendParameters_w(uint32_t ssrc) const;
479 bool SetRtpSendParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters);
480 webrtc::RtpParameters GetRtpReceiveParameters_w(uint32_t ssrc) const;
481 bool SetRtpReceiveParameters_w(uint32_t ssrc,
482 webrtc::RtpParameters parameters);
zhihuang184a3fd2016-06-14 18:47:14483 cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_AUDIO; }
henrike@webrtc.org28e20752013-07-10 00:45:36484
henrike@webrtc.org28e20752013-07-10 00:45:36485 private:
486 // overrides from BaseChannel
Danil Chapovalov33b01f22016-05-11 17:55:27487 void OnChannelRead(TransportChannel* channel,
488 const char* data,
489 size_t len,
490 const rtc::PacketTime& packet_time,
491 int flags) override;
Taylor Brandstetterbad33bf2016-08-25 20:31:14492 void UpdateMediaSendRecvState_w() override;
Danil Chapovalov33b01f22016-05-11 17:55:27493 const ContentInfo* GetFirstContent(const SessionDescription* sdesc) override;
494 bool SetLocalContent_w(const MediaContentDescription* content,
495 ContentAction action,
496 std::string* error_desc) override;
497 bool SetRemoteContent_w(const MediaContentDescription* content,
498 ContentAction action,
499 std::string* error_desc) override;
henrike@webrtc.org28e20752013-07-10 00:45:36500 void HandleEarlyMediaTimeout();
solenberg1d63dd02015-12-02 20:35:09501 bool InsertDtmf_w(uint32_t ssrc, int event, int duration);
solenberg4bac9c52015-10-09 09:32:53502 bool SetOutputVolume_w(uint32_t ssrc, double volume);
henrike@webrtc.org28e20752013-07-10 00:45:36503 bool GetStats_w(VoiceMediaInfo* stats);
504
Danil Chapovalov33b01f22016-05-11 17:55:27505 void OnMessage(rtc::Message* pmsg) override;
506 void GetSrtpCryptoSuites_n(std::vector<int>* crypto_suites) const override;
507 void OnConnectionMonitorUpdate(
508 ConnectionMonitor* monitor,
509 const std::vector<ConnectionInfo>& infos) override;
510 void OnMediaMonitorUpdate(VoiceMediaChannel* media_channel,
511 const VoiceMediaInfo& info);
henrike@webrtc.org28e20752013-07-10 00:45:36512 void OnAudioMonitorUpdate(AudioMonitor* monitor, const AudioInfo& info);
henrike@webrtc.org28e20752013-07-10 00:45:36513
514 static const int kEarlyMediaTimeout = 1000;
Fredrik Solenberg0c022642015-08-05 10:25:22515 MediaEngineInterface* media_engine_;
henrike@webrtc.org28e20752013-07-10 00:45:36516 bool received_media_;
kwiberg31022942016-03-11 22:18:21517 std::unique_ptr<VoiceMediaMonitor> media_monitor_;
518 std::unique_ptr<AudioMonitor> audio_monitor_;
Peter Thatcherc2ee2c82015-08-07 23:05:34519
520 // Last AudioSendParameters sent down to the media_channel() via
521 // SetSendParameters.
522 AudioSendParameters last_send_params_;
523 // Last AudioRecvParameters sent down to the media_channel() via
524 // SetRecvParameters.
525 AudioRecvParameters last_recv_params_;
henrike@webrtc.org28e20752013-07-10 00:45:36526};
527
528// VideoChannel is a specialization for video.
529class VideoChannel : public BaseChannel {
530 public:
Danil Chapovalov33b01f22016-05-11 17:55:27531 VideoChannel(rtc::Thread* worker_thread,
532 rtc::Thread* netwokr_thread,
deadbeefcbecd352015-09-23 18:50:27533 VideoMediaChannel* channel,
534 TransportController* transport_controller,
535 const std::string& content_name,
Fredrik Solenberg0c022642015-08-05 10:25:22536 bool rtcp);
henrike@webrtc.org28e20752013-07-10 00:45:36537 ~VideoChannel();
skvlad6c87a672016-05-18 00:49:52538 bool Init_w(const std::string* bundle_transport_name);
henrike@webrtc.org28e20752013-07-10 00:45:36539
Fredrik Solenberg4b60c732015-05-07 12:07:48540 // downcasts a MediaChannel
Danil Chapovalov33b01f22016-05-11 17:55:27541 VideoMediaChannel* media_channel() const override {
Fredrik Solenberg4b60c732015-05-07 12:07:48542 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel());
543 }
544
nisse08582ff2016-02-04 09:24:52545 bool SetSink(uint32_t ssrc, rtc::VideoSinkInterface<VideoFrame>* sink);
henrike@webrtc.org28e20752013-07-10 00:45:36546 // Get statistics about the current media session.
pbos@webrtc.org058b1f12015-03-04 08:54:32547 bool GetStats(VideoMediaInfo* stats);
henrike@webrtc.org28e20752013-07-10 00:45:36548
549 sigslot::signal2<VideoChannel*, const std::vector<ConnectionInfo>&>
550 SignalConnectionMonitor;
551
552 void StartMediaMonitor(int cms);
553 void StopMediaMonitor();
554 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor;
henrike@webrtc.org28e20752013-07-10 00:45:36555
deadbeef5a4a75a2016-06-02 23:23:38556 // Register a source and set options.
557 // The |ssrc| must correspond to a registered send stream.
558 bool SetVideoSend(uint32_t ssrc,
559 bool enable,
560 const VideoOptions* options,
561 rtc::VideoSourceInterface<cricket::VideoFrame>* source);
Taylor Brandstetterdb0cd9e2016-05-16 18:40:30562 webrtc::RtpParameters GetRtpSendParameters(uint32_t ssrc) const;
563 bool SetRtpSendParameters(uint32_t ssrc,
564 const webrtc::RtpParameters& parameters);
565 webrtc::RtpParameters GetRtpReceiveParameters(uint32_t ssrc) const;
566 bool SetRtpReceiveParameters(uint32_t ssrc,
567 const webrtc::RtpParameters& parameters);
zhihuang184a3fd2016-06-14 18:47:14568 cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_VIDEO; }
henrike@webrtc.org28e20752013-07-10 00:45:36569
henrike@webrtc.org28e20752013-07-10 00:45:36570 private:
henrike@webrtc.org28e20752013-07-10 00:45:36571 // overrides from BaseChannel
Taylor Brandstetterbad33bf2016-08-25 20:31:14572 void UpdateMediaSendRecvState_w() override;
Danil Chapovalov33b01f22016-05-11 17:55:27573 const ContentInfo* GetFirstContent(const SessionDescription* sdesc) override;
574 bool SetLocalContent_w(const MediaContentDescription* content,
575 ContentAction action,
576 std::string* error_desc) override;
577 bool SetRemoteContent_w(const MediaContentDescription* content,
578 ContentAction action,
579 std::string* error_desc) override;
henrike@webrtc.org28e20752013-07-10 00:45:36580 bool GetStats_w(VideoMediaInfo* stats);
Taylor Brandstetterdb0cd9e2016-05-16 18:40:30581 webrtc::RtpParameters GetRtpSendParameters_w(uint32_t ssrc) const;
582 bool SetRtpSendParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters);
583 webrtc::RtpParameters GetRtpReceiveParameters_w(uint32_t ssrc) const;
584 bool SetRtpReceiveParameters_w(uint32_t ssrc,
585 webrtc::RtpParameters parameters);
henrike@webrtc.org28e20752013-07-10 00:45:36586
Danil Chapovalov33b01f22016-05-11 17:55:27587 void OnMessage(rtc::Message* pmsg) override;
588 void GetSrtpCryptoSuites_n(std::vector<int>* crypto_suites) const override;
589 void OnConnectionMonitorUpdate(
590 ConnectionMonitor* monitor,
591 const std::vector<ConnectionInfo>& infos) override;
592 void OnMediaMonitorUpdate(VideoMediaChannel* media_channel,
593 const VideoMediaInfo& info);
henrike@webrtc.org28e20752013-07-10 00:45:36594
kwiberg31022942016-03-11 22:18:21595 std::unique_ptr<VideoMediaMonitor> media_monitor_;
henrike@webrtc.org28e20752013-07-10 00:45:36596
Peter Thatcherc2ee2c82015-08-07 23:05:34597 // Last VideoSendParameters sent down to the media_channel() via
598 // SetSendParameters.
599 VideoSendParameters last_send_params_;
600 // Last VideoRecvParameters sent down to the media_channel() via
601 // SetRecvParameters.
602 VideoRecvParameters last_recv_params_;
henrike@webrtc.org28e20752013-07-10 00:45:36603};
604
605// DataChannel is a specialization for data.
606class DataChannel : public BaseChannel {
607 public:
Danil Chapovalov33b01f22016-05-11 17:55:27608 DataChannel(rtc::Thread* worker_thread,
609 rtc::Thread* network_thread,
henrike@webrtc.org28e20752013-07-10 00:45:36610 DataMediaChannel* media_channel,
deadbeefcbecd352015-09-23 18:50:27611 TransportController* transport_controller,
henrike@webrtc.org28e20752013-07-10 00:45:36612 const std::string& content_name,
613 bool rtcp);
614 ~DataChannel();
skvlad6c87a672016-05-18 00:49:52615 bool Init_w(const std::string* bundle_transport_name);
henrike@webrtc.org28e20752013-07-10 00:45:36616
wu@webrtc.orgd64719d2013-08-01 00:00:07617 virtual bool SendData(const SendDataParams& params,
jbaucheec21bd2016-03-20 13:15:43618 const rtc::CopyOnWriteBuffer& payload,
wu@webrtc.orgd64719d2013-08-01 00:00:07619 SendDataResult* result);
henrike@webrtc.org28e20752013-07-10 00:45:36620
621 void StartMediaMonitor(int cms);
622 void StopMediaMonitor();
623
wu@webrtc.org07a6fbe2013-11-04 18:41:34624 // Should be called on the signaling thread only.
625 bool ready_to_send_data() const {
626 return ready_to_send_data_;
627 }
628
henrike@webrtc.org28e20752013-07-10 00:45:36629 sigslot::signal2<DataChannel*, const DataMediaInfo&> SignalMediaMonitor;
630 sigslot::signal2<DataChannel*, const std::vector<ConnectionInfo>&>
631 SignalConnectionMonitor;
jbaucheec21bd2016-03-20 13:15:43632 sigslot::signal3<DataChannel*, const ReceiveDataParams&,
633 const rtc::CopyOnWriteBuffer&> SignalDataReceived;
henrike@webrtc.org28e20752013-07-10 00:45:36634 // Signal for notifying when the channel becomes ready to send data.
wu@webrtc.orgd64719d2013-08-01 00:00:07635 // That occurs when the channel is enabled, the transport is writable,
636 // both local and remote descriptions are set, and the channel is unblocked.
henrike@webrtc.org28e20752013-07-10 00:45:36637 sigslot::signal1<bool> SignalReadyToSendData;
buildbot@webrtc.org1d66be22014-05-29 22:54:24638 // Signal for notifying that the remote side has closed the DataChannel.
Peter Boström0c4e06b2015-10-07 10:23:21639 sigslot::signal1<uint32_t> SignalStreamClosedRemotely;
zhihuang184a3fd2016-06-14 18:47:14640 cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_DATA; }
henrike@webrtc.org28e20752013-07-10 00:45:36641
wu@webrtc.orgcadf9042013-08-30 21:24:16642 protected:
643 // downcasts a MediaChannel.
Danil Chapovalov33b01f22016-05-11 17:55:27644 DataMediaChannel* media_channel() const override {
wu@webrtc.orgcadf9042013-08-30 21:24:16645 return static_cast<DataMediaChannel*>(BaseChannel::media_channel());
646 }
647
henrike@webrtc.org28e20752013-07-10 00:45:36648 private:
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52649 struct SendDataMessageData : public rtc::MessageData {
henrike@webrtc.org28e20752013-07-10 00:45:36650 SendDataMessageData(const SendDataParams& params,
jbaucheec21bd2016-03-20 13:15:43651 const rtc::CopyOnWriteBuffer* payload,
henrike@webrtc.org28e20752013-07-10 00:45:36652 SendDataResult* result)
653 : params(params),
654 payload(payload),
655 result(result),
656 succeeded(false) {
657 }
658
659 const SendDataParams& params;
jbaucheec21bd2016-03-20 13:15:43660 const rtc::CopyOnWriteBuffer* payload;
henrike@webrtc.org28e20752013-07-10 00:45:36661 SendDataResult* result;
662 bool succeeded;
663 };
664
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52665 struct DataReceivedMessageData : public rtc::MessageData {
henrike@webrtc.org28e20752013-07-10 00:45:36666 // We copy the data because the data will become invalid after we
667 // handle DataMediaChannel::SignalDataReceived but before we fire
668 // SignalDataReceived.
669 DataReceivedMessageData(
670 const ReceiveDataParams& params, const char* data, size_t len)
671 : params(params),
672 payload(data, len) {
673 }
674 const ReceiveDataParams params;
jbaucheec21bd2016-03-20 13:15:43675 const rtc::CopyOnWriteBuffer payload;
henrike@webrtc.org28e20752013-07-10 00:45:36676 };
677
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52678 typedef rtc::TypedMessageData<bool> DataChannelReadyToSendMessageData;
wu@webrtc.orgd64719d2013-08-01 00:00:07679
henrike@webrtc.org28e20752013-07-10 00:45:36680 // overrides from BaseChannel
Danil Chapovalov33b01f22016-05-11 17:55:27681 const ContentInfo* GetFirstContent(const SessionDescription* sdesc) override;
henrike@webrtc.org28e20752013-07-10 00:45:36682 // If data_channel_type_ is DCT_NONE, set it. Otherwise, check that
683 // it's the same as what was set previously. Returns false if it's
684 // set to one type one type and changed to another type later.
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54685 bool SetDataChannelType(DataChannelType new_data_channel_type,
686 std::string* error_desc);
henrike@webrtc.org28e20752013-07-10 00:45:36687 // Same as SetDataChannelType, but extracts the type from the
688 // DataContentDescription.
sergeyu@chromium.org4b26e2e2014-01-15 23:15:54689 bool SetDataChannelTypeFromContent(const DataContentDescription* content,
690 std::string* error_desc);
Danil Chapovalov33b01f22016-05-11 17:55:27691 bool SetLocalContent_w(const MediaContentDescription* content,
692 ContentAction action,
693 std::string* error_desc) override;
694 bool SetRemoteContent_w(const MediaContentDescription* content,
695 ContentAction action,
696 std::string* error_desc) override;
Taylor Brandstetterbad33bf2016-08-25 20:31:14697 void UpdateMediaSendRecvState_w() override;
Danil Chapovalov33b01f22016-05-11 17:55:27698 bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet) override;
henrike@webrtc.org28e20752013-07-10 00:45:36699
Danil Chapovalov33b01f22016-05-11 17:55:27700 void OnMessage(rtc::Message* pmsg) override;
701 void GetSrtpCryptoSuites_n(std::vector<int>* crypto_suites) const override;
702 void OnConnectionMonitorUpdate(
703 ConnectionMonitor* monitor,
704 const std::vector<ConnectionInfo>& infos) override;
705 void OnMediaMonitorUpdate(DataMediaChannel* media_channel,
706 const DataMediaInfo& info);
707 bool ShouldSetupDtlsSrtp_n() const override;
henrike@webrtc.org28e20752013-07-10 00:45:36708 void OnDataReceived(
709 const ReceiveDataParams& params, const char* data, size_t len);
Peter Boström0c4e06b2015-10-07 10:23:21710 void OnDataChannelError(uint32_t ssrc, DataMediaChannel::Error error);
wu@webrtc.orgd64719d2013-08-01 00:00:07711 void OnDataChannelReadyToSend(bool writable);
Peter Boström0c4e06b2015-10-07 10:23:21712 void OnStreamClosedRemotely(uint32_t sid);
henrike@webrtc.org28e20752013-07-10 00:45:36713
kwiberg31022942016-03-11 22:18:21714 std::unique_ptr<DataMediaMonitor> media_monitor_;
henrike@webrtc.org28e20752013-07-10 00:45:36715 // TODO(pthatcher): Make a separate SctpDataChannel and
716 // RtpDataChannel instead of using this.
717 DataChannelType data_channel_type_;
wu@webrtc.org07a6fbe2013-11-04 18:41:34718 bool ready_to_send_data_;
Peter Thatcherc2ee2c82015-08-07 23:05:34719
720 // Last DataSendParameters sent down to the media_channel() via
721 // SetSendParameters.
722 DataSendParameters last_send_params_;
723 // Last DataRecvParameters sent down to the media_channel() via
724 // SetRecvParameters.
725 DataRecvParameters last_recv_params_;
henrike@webrtc.org28e20752013-07-10 00:45:36726};
727
728} // namespace cricket
729
perkjc11b1842016-03-08 01:34:13730#endif // WEBRTC_PC_CHANNEL_H_