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

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

Issue 2794943002: Delete MediaController class, move Call ownership to PeerConnection. (Closed)
Patch Set: Hack for injecting a FakeCall, and re-enable TestPacketOptionsAndOnPacketSent test. Created 3 years, 7 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/pc/test/mock_webrtcsession.h ('k') | webrtc/pc/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_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/mediacontroller.h"
31 #include "webrtc/pc/mediasession.h" 30 #include "webrtc/pc/mediasession.h"
32 31
33 #ifdef HAVE_QUIC 32 #ifdef HAVE_QUIC
34 #include "webrtc/pc/quicdatatransport.h" 33 #include "webrtc/pc/quicdatatransport.h"
35 #endif // HAVE_QUIC 34 #endif // HAVE_QUIC
36 35
37 namespace cricket { 36 namespace cricket {
38 37
39 class ChannelManager; 38 class ChannelManager;
40 class RtpDataChannel; 39 class RtpDataChannel;
41 class SctpTransportInternal; 40 class SctpTransportInternal;
42 class SctpTransportInternalFactory; 41 class SctpTransportInternalFactory;
43 class StatsReport; 42 class StatsReport;
44 class VideoChannel; 43 class VideoChannel;
45 class VoiceChannel; 44 class VoiceChannel;
46 45
47 #ifdef HAVE_QUIC 46 #ifdef HAVE_QUIC
48 class QuicTransportChannel; 47 class QuicTransportChannel;
49 #endif // HAVE_QUIC 48 #endif // HAVE_QUIC
50 49
51 } // namespace cricket 50 } // namespace cricket
52 51
53 namespace webrtc { 52 namespace webrtc {
54 53
55 class IceRestartAnswerLatch; 54 class IceRestartAnswerLatch;
56 class JsepIceCandidate; 55 class JsepIceCandidate;
57 class MediaStreamSignaling; 56 class MediaStreamSignaling;
57 class RtcEventLog;
58 class WebRtcSessionDescriptionFactory; 58 class WebRtcSessionDescriptionFactory;
59 59
60 extern const char kBundleWithoutRtcpMux[]; 60 extern const char kBundleWithoutRtcpMux[];
61 extern const char kCreateChannelFailed[]; 61 extern const char kCreateChannelFailed[];
62 extern const char kInvalidCandidates[]; 62 extern const char kInvalidCandidates[];
63 extern const char kInvalidSdp[]; 63 extern const char kInvalidSdp[];
64 extern const char kMlineMismatch[]; 64 extern const char kMlineMismatch[];
65 extern const char kPushDownTDFailed[]; 65 extern const char kPushDownTDFailed[];
66 extern const char kSdpWithoutDtlsFingerprint[]; 66 extern const char kSdpWithoutDtlsFingerprint[];
67 extern const char kSdpWithoutSdesCrypto[]; 67 extern const char kSdpWithoutSdesCrypto[];
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 }; 152 };
153 153
154 enum Error { 154 enum Error {
155 ERROR_NONE = 0, // no error 155 ERROR_NONE = 0, // no error
156 ERROR_CONTENT = 1, // channel errors in SetLocalContent/SetRemoteContent 156 ERROR_CONTENT = 1, // channel errors in SetLocalContent/SetRemoteContent
157 ERROR_TRANSPORT = 2, // transport error of some kind 157 ERROR_TRANSPORT = 2, // transport error of some kind
158 }; 158 };
159 159
160 // |sctp_factory| may be null, in which case SCTP is treated as unsupported. 160 // |sctp_factory| may be null, in which case SCTP is treated as unsupported.
161 WebRtcSession( 161 WebRtcSession(
162 webrtc::MediaControllerInterface* media_controller, 162 cricket::ChannelManager* channel_manager,
163 const cricket::MediaConfig& media_config,
164 RtcEventLog* event_log,
163 rtc::Thread* network_thread, 165 rtc::Thread* network_thread,
164 rtc::Thread* worker_thread, 166 rtc::Thread* worker_thread,
165 rtc::Thread* signaling_thread, 167 rtc::Thread* signaling_thread,
166 cricket::PortAllocator* port_allocator, 168 cricket::PortAllocator* port_allocator,
167 std::unique_ptr<cricket::TransportController> transport_controller, 169 std::unique_ptr<cricket::TransportController> transport_controller,
168 std::unique_ptr<cricket::SctpTransportInternalFactory> sctp_factory); 170 std::unique_ptr<cricket::SctpTransportInternalFactory> sctp_factory);
169 virtual ~WebRtcSession(); 171 virtual ~WebRtcSession();
170 172
171 // These are const to allow them to be called from const methods. 173 // These are const to allow them to be called from const methods.
172 rtc::Thread* network_thread() const { return network_thread_; } 174 rtc::Thread* network_thread() const { return network_thread_; }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 // Called when a valid data channel OPEN message is received. 357 // Called when a valid data channel OPEN message is received.
356 // std::string represents the data channel label. 358 // std::string represents the data channel label.
357 sigslot::signal2<const std::string&, const InternalDataChannelInit&> 359 sigslot::signal2<const std::string&, const InternalDataChannelInit&>
358 SignalDataChannelOpenMessage; 360 SignalDataChannelOpenMessage;
359 #ifdef HAVE_QUIC 361 #ifdef HAVE_QUIC
360 QuicDataTransport* quic_data_transport() { 362 QuicDataTransport* quic_data_transport() {
361 return quic_data_transport_.get(); 363 return quic_data_transport_.get();
362 } 364 }
363 #endif // HAVE_QUIC 365 #endif // HAVE_QUIC
364 366
367 // To let tests override the Call object we use.
368 protected:
369 virtual Call* call() { return call_.get(); };
nisse-webrtc 2017/04/27 13:46:34 This is a bit ugly. It's needed *only* for the tes
Taylor Brandstetter 2017/04/30 07:21:29 I think it would make more sense to pass a Call in
370
365 private: 371 private:
366 // Indicates the type of SessionDescription in a call to SetLocalDescription 372 // Indicates the type of SessionDescription in a call to SetLocalDescription
367 // and SetRemoteDescription. 373 // and SetRemoteDescription.
368 enum Action { 374 enum Action {
369 kOffer, 375 kOffer,
370 kPrAnswer, 376 kPrAnswer,
371 kAnswer, 377 kAnswer,
372 }; 378 };
373 379
374 // Non-const versions of local_description()/remote_description(), for use 380 // Non-const versions of local_description()/remote_description(), for use
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 545
540 void OnSentPacket_w(const rtc::SentPacket& sent_packet); 546 void OnSentPacket_w(const rtc::SentPacket& sent_packet);
541 547
542 const std::string GetTransportName(const std::string& content_name); 548 const std::string GetTransportName(const std::string& content_name);
543 549
544 void DestroyRtcpTransport_n(const std::string& transport_name); 550 void DestroyRtcpTransport_n(const std::string& transport_name);
545 void DestroyVideoChannel(); 551 void DestroyVideoChannel();
546 void DestroyVoiceChannel(); 552 void DestroyVoiceChannel();
547 void DestroyDataChannel(); 553 void DestroyDataChannel();
548 554
555 void Init_w();
556 void Close_w();
557
549 rtc::Thread* const network_thread_; 558 rtc::Thread* const network_thread_;
550 rtc::Thread* const worker_thread_; 559 rtc::Thread* const worker_thread_;
551 rtc::Thread* const signaling_thread_; 560 rtc::Thread* const signaling_thread_;
552 561
553 State state_ = STATE_INIT; 562 State state_ = STATE_INIT;
554 Error error_ = ERROR_NONE; 563 Error error_ = ERROR_NONE;
555 std::string error_desc_; 564 std::string error_desc_;
556 565
557 const std::string sid_; 566 const std::string sid_;
558 bool initial_offerer_ = false; 567 bool initial_offerer_ = false;
559 568
560 const std::unique_ptr<cricket::TransportController> transport_controller_; 569 const std::unique_ptr<cricket::TransportController> transport_controller_;
561 const std::unique_ptr<cricket::SctpTransportInternalFactory> sctp_factory_; 570 const std::unique_ptr<cricket::SctpTransportInternalFactory> sctp_factory_;
562 MediaControllerInterface* media_controller_; 571 const cricket::MediaConfig media_config_;
572 RtcEventLog* event_log_;
573 std::unique_ptr<Call> call_;
563 std::unique_ptr<cricket::VoiceChannel> voice_channel_; 574 std::unique_ptr<cricket::VoiceChannel> voice_channel_;
564 std::unique_ptr<cricket::VideoChannel> video_channel_; 575 std::unique_ptr<cricket::VideoChannel> video_channel_;
565 // |rtp_data_channel_| is used if in RTP data channel mode, |sctp_transport_| 576 // |rtp_data_channel_| is used if in RTP data channel mode, |sctp_transport_|
566 // when using SCTP. 577 // when using SCTP.
567 std::unique_ptr<cricket::RtpDataChannel> rtp_data_channel_; 578 std::unique_ptr<cricket::RtpDataChannel> rtp_data_channel_;
568 579
569 std::unique_ptr<cricket::SctpTransportInternal> sctp_transport_; 580 std::unique_ptr<cricket::SctpTransportInternal> sctp_transport_;
570 // |sctp_transport_name_| keeps track of what DTLS transport the SCTP 581 // |sctp_transport_name_| keeps track of what DTLS transport the SCTP
571 // transport is using (which can change due to bundling). 582 // transport is using (which can change due to bundling).
572 rtc::Optional<std::string> sctp_transport_name_; 583 rtc::Optional<std::string> sctp_transport_name_;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 644
634 #ifdef HAVE_QUIC 645 #ifdef HAVE_QUIC
635 std::unique_ptr<QuicDataTransport> quic_data_transport_; 646 std::unique_ptr<QuicDataTransport> quic_data_transport_;
636 #endif // HAVE_QUIC 647 #endif // HAVE_QUIC
637 648
638 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); 649 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
639 }; 650 };
640 } // namespace webrtc 651 } // namespace webrtc
641 652
642 #endif // WEBRTC_PC_WEBRTCSESSION_H_ 653 #endif // WEBRTC_PC_WEBRTCSESSION_H_
OLDNEW
« no previous file with comments | « webrtc/pc/test/mock_webrtcsession.h ('k') | webrtc/pc/webrtcsession.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698