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_API_WEBRTCSESSION_H_ | 11 #ifndef WEBRTC_API_WEBRTCSESSION_H_ |
12 #define WEBRTC_API_WEBRTCSESSION_H_ | 12 #define WEBRTC_API_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/datachannel.h" | 19 #include "webrtc/api/datachannel.h" |
20 #include "webrtc/api/dtmfsender.h" | 20 #include "webrtc/api/dtmfsender.h" |
21 #include "webrtc/api/mediacontroller.h" | 21 #include "webrtc/api/mediacontroller.h" |
22 #include "webrtc/api/mediastreamprovider.h" | |
23 #include "webrtc/api/peerconnectioninterface.h" | 22 #include "webrtc/api/peerconnectioninterface.h" |
24 #include "webrtc/api/statstypes.h" | 23 #include "webrtc/api/statstypes.h" |
25 #include "webrtc/base/constructormagic.h" | 24 #include "webrtc/base/constructormagic.h" |
26 #include "webrtc/base/sigslot.h" | 25 #include "webrtc/base/sigslot.h" |
27 #include "webrtc/base/sslidentity.h" | 26 #include "webrtc/base/sslidentity.h" |
28 #include "webrtc/base/thread.h" | 27 #include "webrtc/base/thread.h" |
29 #include "webrtc/media/base/mediachannel.h" | 28 #include "webrtc/media/base/mediachannel.h" |
30 #include "webrtc/p2p/base/candidate.h" | 29 #include "webrtc/p2p/base/candidate.h" |
31 #include "webrtc/p2p/base/transportcontroller.h" | 30 #include "webrtc/p2p/base/transportcontroller.h" |
32 #include "webrtc/pc/mediasession.h" | 31 #include "webrtc/pc/mediasession.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 TransportStatsMap transport_stats; | 107 TransportStatsMap transport_stats; |
109 }; | 108 }; |
110 | 109 |
111 // A WebRtcSession manages general session state. This includes negotiation | 110 // A WebRtcSession manages general session state. This includes negotiation |
112 // of both the application-level and network-level protocols: the former | 111 // of both the application-level and network-level protocols: the former |
113 // defines what will be sent and the latter defines how it will be sent. Each | 112 // defines what will be sent and the latter defines how it will be sent. Each |
114 // network-level protocol is represented by a Transport object. Each Transport | 113 // network-level protocol is represented by a Transport object. Each Transport |
115 // participates in the network-level negotiation. The individual streams of | 114 // participates in the network-level negotiation. The individual streams of |
116 // packets are represented by TransportChannels. The application-level protocol | 115 // packets are represented by TransportChannels. The application-level protocol |
117 // is represented by SessionDecription objects. | 116 // is represented by SessionDecription objects. |
118 class WebRtcSession : public AudioProviderInterface, | 117 class WebRtcSession : |
119 public VideoProviderInterface, | 118 |
120 public DtmfProviderInterface, | 119 public DtmfProviderInterface, |
121 public DataChannelProviderInterface, | 120 public DataChannelProviderInterface, |
122 public sigslot::has_slots<> { | 121 public sigslot::has_slots<> { |
123 public: | 122 public: |
124 enum State { | 123 enum State { |
125 STATE_INIT = 0, | 124 STATE_INIT = 0, |
126 STATE_SENTOFFER, // Sent offer, waiting for answer. | 125 STATE_SENTOFFER, // Sent offer, waiting for answer. |
127 STATE_RECEIVEDOFFER, // Received an offer. Need to send answer. | 126 STATE_RECEIVEDOFFER, // Received an offer. Need to send answer. |
128 STATE_SENTPRANSWER, // Sent provisional answer. Need to send answer. | 127 STATE_SENTPRANSWER, // Sent provisional answer. Need to send answer. |
129 STATE_RECEIVEDPRANSWER, // Received provisional answer, waiting for answer. | 128 STATE_RECEIVEDPRANSWER, // Received provisional answer, waiting for answer. |
130 STATE_INPROGRESS, // Offer/answer exchange completed. | 129 STATE_INPROGRESS, // Offer/answer exchange completed. |
131 STATE_CLOSED, // Close() was called. | 130 STATE_CLOSED, // Close() was called. |
132 }; | 131 }; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 return local_desc_.get(); | 226 return local_desc_.get(); |
228 } | 227 } |
229 const SessionDescriptionInterface* remote_description() const { | 228 const SessionDescriptionInterface* remote_description() const { |
230 return remote_desc_.get(); | 229 return remote_desc_.get(); |
231 } | 230 } |
232 | 231 |
233 // Get the id used as a media stream track's "id" field from ssrc. | 232 // Get the id used as a media stream track's "id" field from ssrc. |
234 virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id); | 233 virtual bool GetLocalTrackIdBySsrc(uint32_t ssrc, std::string* track_id); |
235 virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id); | 234 virtual bool GetRemoteTrackIdBySsrc(uint32_t ssrc, std::string* track_id); |
236 | 235 |
237 // AudioMediaProviderInterface implementation. | |
238 void SetAudioPlayout(uint32_t ssrc, bool enable) override; | |
239 void SetAudioSend(uint32_t ssrc, | |
240 bool enable, | |
241 const cricket::AudioOptions& options, | |
242 cricket::AudioSource* source) override; | |
243 void SetAudioPlayoutVolume(uint32_t ssrc, double volume) override; | |
244 void SetRawAudioSink(uint32_t ssrc, | |
245 std::unique_ptr<AudioSinkInterface> sink) override; | |
246 | |
247 RtpParameters GetAudioRtpSendParameters(uint32_t ssrc) const override; | |
248 bool SetAudioRtpSendParameters(uint32_t ssrc, | |
249 const RtpParameters& parameters) override; | |
250 RtpParameters GetAudioRtpReceiveParameters(uint32_t ssrc) const override; | |
251 bool SetAudioRtpReceiveParameters(uint32_t ssrc, | |
252 const RtpParameters& parameters) override; | |
253 | |
254 // Implements VideoMediaProviderInterface. | |
255 void SetVideoPlayout( | |
256 uint32_t ssrc, | |
257 bool enable, | |
258 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) override; | |
259 void SetVideoSend( | |
260 uint32_t ssrc, | |
261 bool enable, | |
262 const cricket::VideoOptions* options, | |
263 rtc::VideoSourceInterface<cricket::VideoFrame>* source) override; | |
264 | |
265 RtpParameters GetVideoRtpSendParameters(uint32_t ssrc) const override; | |
266 bool SetVideoRtpSendParameters(uint32_t ssrc, | |
267 const RtpParameters& parameters) override; | |
268 RtpParameters GetVideoRtpReceiveParameters(uint32_t ssrc) const override; | |
269 bool SetVideoRtpReceiveParameters(uint32_t ssrc, | |
270 const RtpParameters& parameters) override; | |
271 | |
272 // Implements DtmfProviderInterface. | 236 // Implements DtmfProviderInterface. |
273 bool CanInsertDtmf(const std::string& track_id) override; | 237 bool CanInsertDtmf(const std::string& track_id) override; |
274 bool InsertDtmf(const std::string& track_id, | 238 bool InsertDtmf(const std::string& track_id, |
275 int code, int duration) override; | 239 int code, int duration) override; |
276 sigslot::signal0<>* GetOnDestroyedSignal() override; | 240 sigslot::signal0<>* GetOnDestroyedSignal() override; |
277 | 241 |
278 // Implements DataChannelProviderInterface. | 242 // Implements DataChannelProviderInterface. |
279 bool SendData(const cricket::SendDataParams& params, | 243 bool SendData(const cricket::SendDataParams& params, |
280 const rtc::CopyOnWriteBuffer& payload, | 244 const rtc::CopyOnWriteBuffer& payload, |
281 cricket::SendDataResult* result) override; | 245 cricket::SendDataResult* result) override; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 PeerConnectionInterface::BundlePolicy bundle_policy_; | 489 PeerConnectionInterface::BundlePolicy bundle_policy_; |
526 | 490 |
527 // Declares the RTCP mux policy for the WebRTCSession. | 491 // Declares the RTCP mux policy for the WebRTCSession. |
528 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; | 492 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; |
529 | 493 |
530 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); | 494 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); |
531 }; | 495 }; |
532 } // namespace webrtc | 496 } // namespace webrtc |
533 | 497 |
534 #endif // WEBRTC_API_WEBRTCSESSION_H_ | 498 #endif // WEBRTC_API_WEBRTCSESSION_H_ |
OLD | NEW |