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

Side by Side Diff: webrtc/api/webrtcsession.h

Issue 2046173002: Use VoiceChannel/VideoChannel directly from RtpSender/RtpReceiver. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Moving code that needs to execute out of RTC_DCHECKs. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « webrtc/api/rtpsenderreceiver_unittest.cc ('k') | webrtc/api/webrtcsession.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 21 matching lines...) Expand all
303 267
304 cricket::DataChannelType data_channel_type() const; 268 cricket::DataChannelType data_channel_type() const;
305 269
306 bool IceRestartPending(const std::string& content_name) const; 270 bool IceRestartPending(const std::string& content_name) const;
307 271
308 // Called when an RTCCertificate is generated or retrieved by 272 // Called when an RTCCertificate is generated or retrieved by
309 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. 273 // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription.
310 void OnCertificateReady( 274 void OnCertificateReady(
311 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); 275 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate);
312 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp); 276 void OnDtlsSetupFailure(cricket::BaseChannel*, bool rtcp);
313 // Called when the channel received the first packet.
314 void OnChannelFirstPacketReceived(cricket::BaseChannel*);
315 277
316 // For unit test. 278 // For unit test.
317 bool waiting_for_certificate_for_testing() const; 279 bool waiting_for_certificate_for_testing() const;
318 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing(); 280 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate_for_testing();
319 281
320 void set_metrics_observer( 282 void set_metrics_observer(
321 webrtc::MetricsObserverInterface* metrics_observer) { 283 webrtc::MetricsObserverInterface* metrics_observer) {
322 metrics_observer_ = metrics_observer; 284 metrics_observer_ = metrics_observer;
323 } 285 }
324 286
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; 492 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_;
531 493
532 bool received_first_video_packet_ = false; 494 bool received_first_video_packet_ = false;
533 bool received_first_audio_packet_ = false; 495 bool received_first_audio_packet_ = false;
534 496
535 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); 497 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
536 }; 498 };
537 } // namespace webrtc 499 } // namespace webrtc
538 500
539 #endif // WEBRTC_API_WEBRTCSESSION_H_ 501 #endif // WEBRTC_API_WEBRTCSESSION_H_
OLDNEW
« no previous file with comments | « webrtc/api/rtpsenderreceiver_unittest.cc ('k') | webrtc/api/webrtcsession.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698