OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_PC_WEBRTCSESSION_H_ | 11 #ifndef WEBRTC_PC_WEBRTCSESSION_H_ |
12 #define WEBRTC_PC_WEBRTCSESSION_H_ | 12 #define WEBRTC_PC_WEBRTCSESSION_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <set> | 15 #include <set> |
16 #include <string> | 16 #include <string> |
17 #include <vector> | 17 #include <vector> |
18 | 18 |
19 #include "webrtc/api/peerconnectioninterface.h" | 19 #include "webrtc/api/peerconnectioninterface.h" |
20 #include "webrtc/api/statstypes.h" | 20 #include "webrtc/api/statstypes.h" |
21 #include "webrtc/base/constructormagic.h" | 21 #include "webrtc/base/constructormagic.h" |
22 #include "webrtc/base/optional.h" | 22 #include "webrtc/base/optional.h" |
23 #include "webrtc/base/sigslot.h" | 23 #include "webrtc/base/sigslot.h" |
24 #include "webrtc/base/sslidentity.h" | 24 #include "webrtc/base/sslidentity.h" |
25 #include "webrtc/base/thread.h" | 25 #include "webrtc/base/thread.h" |
26 #include "webrtc/media/base/mediachannel.h" | 26 #include "webrtc/media/base/mediachannel.h" |
27 #include "webrtc/p2p/base/candidate.h" | 27 #include "webrtc/p2p/base/candidate.h" |
28 #include "webrtc/p2p/base/transportcontroller.h" | 28 #include "webrtc/p2p/base/transportcontroller.h" |
29 #include "webrtc/pc/datachannel.h" | 29 #include "webrtc/pc/datachannel.h" |
30 #include "webrtc/pc/dtmfsender.h" | |
31 #include "webrtc/pc/mediacontroller.h" | 30 #include "webrtc/pc/mediacontroller.h" |
32 #include "webrtc/pc/mediasession.h" | 31 #include "webrtc/pc/mediasession.h" |
33 | 32 |
34 #ifdef HAVE_QUIC | 33 #ifdef HAVE_QUIC |
35 #include "webrtc/pc/quicdatatransport.h" | 34 #include "webrtc/pc/quicdatatransport.h" |
36 #endif // HAVE_QUIC | 35 #endif // HAVE_QUIC |
37 | 36 |
38 namespace cricket { | 37 namespace cricket { |
39 | 38 |
40 class ChannelManager; | 39 class ChannelManager; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 }; | 132 }; |
134 | 133 |
135 // A WebRtcSession manages general session state. This includes negotiation | 134 // A WebRtcSession manages general session state. This includes negotiation |
136 // of both the application-level and network-level protocols: the former | 135 // of both the application-level and network-level protocols: the former |
137 // defines what will be sent and the latter defines how it will be sent. Each | 136 // defines what will be sent and the latter defines how it will be sent. Each |
138 // network-level protocol is represented by a Transport object. Each Transport | 137 // network-level protocol is represented by a Transport object. Each Transport |
139 // participates in the network-level negotiation. The individual streams of | 138 // participates in the network-level negotiation. The individual streams of |
140 // packets are represented by TransportChannels. The application-level protocol | 139 // packets are represented by TransportChannels. The application-level protocol |
141 // is represented by SessionDecription objects. | 140 // is represented by SessionDecription objects. |
142 class WebRtcSession : | 141 class WebRtcSession : |
143 | |
144 public DtmfProviderInterface, | |
145 public DataChannelProviderInterface, | 142 public DataChannelProviderInterface, |
146 public sigslot::has_slots<> { | 143 public sigslot::has_slots<> { |
147 public: | 144 public: |
148 enum State { | 145 enum State { |
149 STATE_INIT = 0, | 146 STATE_INIT = 0, |
150 STATE_SENTOFFER, // Sent offer, waiting for answer. | 147 STATE_SENTOFFER, // Sent offer, waiting for answer. |
151 STATE_RECEIVEDOFFER, // Received an offer. Need to send answer. | 148 STATE_RECEIVEDOFFER, // Received an offer. Need to send answer. |
152 STATE_SENTPRANSWER, // Sent provisional answer. Need to send answer. | 149 STATE_SENTPRANSWER, // Sent provisional answer. Need to send answer. |
153 STATE_RECEIVEDPRANSWER, // Received provisional answer, waiting for answer. | 150 STATE_RECEIVEDPRANSWER, // Received provisional answer, waiting for answer. |
154 STATE_INPROGRESS, // Offer/answer exchange completed. | 151 STATE_INPROGRESS, // Offer/answer exchange completed. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 return pending_local_description_.get(); | 275 return pending_local_description_.get(); |
279 } | 276 } |
280 const SessionDescriptionInterface* pending_remote_description() const { | 277 const SessionDescriptionInterface* pending_remote_description() const { |
281 return pending_remote_description_.get(); | 278 return pending_remote_description_.get(); |
282 } | 279 } |
283 | 280 |
284 // Get the id used as a media stream track's "id" field from ssrc. | 281 // Get the id used as a media stream track's "id" field from ssrc. |
285 virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id); | 282 virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id); |
286 virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id); | 283 virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id); |
287 | 284 |
288 // Implements DtmfProviderInterface. | |
289 bool CanInsertDtmf(const std::string& track_id) override; | |
290 bool InsertDtmf(const std::string& track_id, | |
291 int code, int duration) override; | |
292 sigslot::signal0<>* GetOnDestroyedSignal() override; | |
293 | |
294 // Implements DataChannelProviderInterface. | 285 // Implements DataChannelProviderInterface. |
295 bool SendData(const cricket::SendDataParams& params, | 286 bool SendData(const cricket::SendDataParams& params, |
296 const rtc::CopyOnWriteBuffer& payload, | 287 const rtc::CopyOnWriteBuffer& payload, |
297 cricket::SendDataResult* result) override; | 288 cricket::SendDataResult* result) override; |
298 bool ConnectDataChannel(DataChannel* webrtc_data_channel) override; | 289 bool ConnectDataChannel(DataChannel* webrtc_data_channel) override; |
299 void DisconnectDataChannel(DataChannel* webrtc_data_channel) override; | 290 void DisconnectDataChannel(DataChannel* webrtc_data_channel) override; |
300 void AddSctpDataStream(int sid) override; | 291 void AddSctpDataStream(int sid) override; |
301 void RemoveSctpDataStream(int sid) override; | 292 void RemoveSctpDataStream(int sid) override; |
302 bool ReadyToSendData() const override; | 293 bool ReadyToSendData() const override; |
303 | 294 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 345 |
355 // Called when voice_channel_, video_channel_ and | 346 // Called when voice_channel_, video_channel_ and |
356 // rtp_data_channel_/sctp_transport_ are created and destroyed. As a result | 347 // rtp_data_channel_/sctp_transport_ are created and destroyed. As a result |
357 // of, for example, setting a new description. | 348 // of, for example, setting a new description. |
358 sigslot::signal0<> SignalVoiceChannelCreated; | 349 sigslot::signal0<> SignalVoiceChannelCreated; |
359 sigslot::signal0<> SignalVoiceChannelDestroyed; | 350 sigslot::signal0<> SignalVoiceChannelDestroyed; |
360 sigslot::signal0<> SignalVideoChannelCreated; | 351 sigslot::signal0<> SignalVideoChannelCreated; |
361 sigslot::signal0<> SignalVideoChannelDestroyed; | 352 sigslot::signal0<> SignalVideoChannelDestroyed; |
362 sigslot::signal0<> SignalDataChannelCreated; | 353 sigslot::signal0<> SignalDataChannelCreated; |
363 sigslot::signal0<> SignalDataChannelDestroyed; | 354 sigslot::signal0<> SignalDataChannelDestroyed; |
364 // Called when the whole session is destroyed. | |
365 sigslot::signal0<> SignalDestroyed; | |
366 | 355 |
367 // Called when a valid data channel OPEN message is received. | 356 // Called when a valid data channel OPEN message is received. |
368 // std::string represents the data channel label. | 357 // std::string represents the data channel label. |
369 sigslot::signal2<const std::string&, const InternalDataChannelInit&> | 358 sigslot::signal2<const std::string&, const InternalDataChannelInit&> |
370 SignalDataChannelOpenMessage; | 359 SignalDataChannelOpenMessage; |
371 #ifdef HAVE_QUIC | 360 #ifdef HAVE_QUIC |
372 QuicDataTransport* quic_data_transport() { | 361 QuicDataTransport* quic_data_transport() { |
373 return quic_data_transport_.get(); | 362 return quic_data_transport_.get(); |
374 } | 363 } |
375 #endif // HAVE_QUIC | 364 #endif // HAVE_QUIC |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 | 634 |
646 #ifdef HAVE_QUIC | 635 #ifdef HAVE_QUIC |
647 std::unique_ptr<QuicDataTransport> quic_data_transport_; | 636 std::unique_ptr<QuicDataTransport> quic_data_transport_; |
648 #endif // HAVE_QUIC | 637 #endif // HAVE_QUIC |
649 | 638 |
650 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 639 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
651 }; | 640 }; |
652 } // namespace webrtc | 641 } // namespace webrtc |
653 | 642 |
654 #endif // WEBRTC_PC_WEBRTCSESSION_H_ | 643 #endif // WEBRTC_PC_WEBRTCSESSION_H_ |
OLD | NEW |