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

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

Issue 1713043002: Late initialize MediaController, for less resource i.e. ProcessThread, usage by PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Ugly but implemented Created 4 years, 10 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
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
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 STATE_INPROGRESS, // Offer/answer exchange completed. 123 STATE_INPROGRESS, // Offer/answer exchange completed.
124 STATE_CLOSED, // Close() was called. 124 STATE_CLOSED, // Close() was called.
125 }; 125 };
126 126
127 enum Error { 127 enum Error {
128 ERROR_NONE = 0, // no error 128 ERROR_NONE = 0, // no error
129 ERROR_CONTENT = 1, // channel errors in SetLocalContent/SetRemoteContent 129 ERROR_CONTENT = 1, // channel errors in SetLocalContent/SetRemoteContent
130 ERROR_TRANSPORT = 2, // transport error of some kind 130 ERROR_TRANSPORT = 2, // transport error of some kind
131 }; 131 };
132 132
133 WebRtcSession(webrtc::MediaControllerInterface* media_controller, 133 WebRtcSession(rtc::Thread* signaling_thread,
134 rtc::Thread* signaling_thread,
135 rtc::Thread* worker_thread, 134 rtc::Thread* worker_thread,
136 cricket::PortAllocator* port_allocator); 135 cricket::PortAllocator* port_allocator);
137 virtual ~WebRtcSession(); 136 virtual ~WebRtcSession();
138 137
139 // These are const to allow them to be called from const methods. 138 // These are const to allow them to be called from const methods.
140 rtc::Thread* signaling_thread() const { return signaling_thread_; } 139 rtc::Thread* signaling_thread() const { return signaling_thread_; }
141 rtc::Thread* worker_thread() const { return worker_thread_; } 140 rtc::Thread* worker_thread() const { return worker_thread_; }
142 cricket::PortAllocator* port_allocator() const { return port_allocator_; } 141 cricket::PortAllocator* port_allocator() const { return port_allocator_; }
143 142
144 // The ID of this session. 143 // The ID of this session.
145 const std::string& id() const { return sid_; } 144 const std::string& id() const { return sid_; }
146 145
147 bool Initialize( 146 bool Initialize(
148 const PeerConnectionFactoryInterface::Options& options, 147 const PeerConnectionFactoryInterface::Options& options,
149 const MediaConstraintsInterface* constraints, 148 const MediaConstraintsInterface* constraints,
150 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, 149 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
151 const PeerConnectionInterface::RTCConfiguration& rtc_configuration); 150 const PeerConnectionInterface::RTCConfiguration& rtc_configuration);
151 void LateInitialize(webrtc::MediaControllerInterface* media_controller);
152 // Deletes the voice, video and data channel and changes the session state 152 // Deletes the voice, video and data channel and changes the session state
153 // to STATE_CLOSED. 153 // to STATE_CLOSED.
154 void Close(); 154 void Close();
155 155
156 // Returns true if we were the initial offerer. 156 // Returns true if we were the initial offerer.
157 bool initial_offerer() const { return initial_offerer_; } 157 bool initial_offerer() const { return initial_offerer_; }
158 158
159 // Returns the current state of the session. See the enum above for details. 159 // Returns the current state of the session. See the enum above for details.
160 // Each time the state changes, we will fire this signal. 160 // Each time the state changes, we will fire this signal.
161 State state() const { return state_; } 161 State state() const { return state_; }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 cricket::PortAllocator* const port_allocator_; 454 cricket::PortAllocator* const port_allocator_;
455 455
456 State state_ = STATE_INIT; 456 State state_ = STATE_INIT;
457 Error error_ = ERROR_NONE; 457 Error error_ = ERROR_NONE;
458 std::string error_desc_; 458 std::string error_desc_;
459 459
460 const std::string sid_; 460 const std::string sid_;
461 bool initial_offerer_ = false; 461 bool initial_offerer_ = false;
462 462
463 rtc::scoped_ptr<cricket::TransportController> transport_controller_; 463 rtc::scoped_ptr<cricket::TransportController> transport_controller_;
464 MediaControllerInterface* media_controller_; 464 MediaControllerInterface* media_controller_ = nullptr;
tommi 2016/02/22 15:22:05 wonder if ownership should simply be here.
the sun 2016/02/23 14:14:03 Ack. See comment peerconnection.cc.
465 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_; 465 rtc::scoped_ptr<cricket::VoiceChannel> voice_channel_;
466 rtc::scoped_ptr<cricket::VideoChannel> video_channel_; 466 rtc::scoped_ptr<cricket::VideoChannel> video_channel_;
467 rtc::scoped_ptr<cricket::DataChannel> data_channel_; 467 rtc::scoped_ptr<cricket::DataChannel> data_channel_;
468 cricket::ChannelManager* channel_manager_;
469 IceObserver* ice_observer_; 468 IceObserver* ice_observer_;
470 PeerConnectionInterface::IceConnectionState ice_connection_state_; 469 PeerConnectionInterface::IceConnectionState ice_connection_state_;
471 bool ice_connection_receiving_; 470 bool ice_connection_receiving_;
472 rtc::scoped_ptr<SessionDescriptionInterface> local_desc_; 471 rtc::scoped_ptr<SessionDescriptionInterface> local_desc_;
473 rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_; 472 rtc::scoped_ptr<SessionDescriptionInterface> remote_desc_;
474 // If the remote peer is using a older version of implementation. 473 // If the remote peer is using a older version of implementation.
475 bool older_version_remote_peer_; 474 bool older_version_remote_peer_ = false;
476 bool dtls_enabled_; 475 bool dtls_enabled_ = false;
476 bool disable_encryption_ = false;
477 rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
478 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store_;
477 // Specifies which kind of data channel is allowed. This is controlled 479 // Specifies which kind of data channel is allowed. This is controlled
478 // by the chrome command-line flag and constraints: 480 // by the chrome command-line flag and constraints:
479 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled, 481 // 1. If chrome command-line switch 'enable-sctp-data-channels' is enabled,
480 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is 482 // constraint kEnableDtlsSrtp is true, and constaint kEnableRtpDataChannels is
481 // not set or false, SCTP is allowed (DCT_SCTP); 483 // not set or false, SCTP is allowed (DCT_SCTP);
482 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP); 484 // 2. If constraint kEnableRtpDataChannels is true, RTP is allowed (DCT_RTP);
483 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE). 485 // 3. If both 1&2 are false, data channel is not allowed (DCT_NONE).
484 cricket::DataChannelType data_channel_type_; 486 cricket::DataChannelType data_channel_type_;
485 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_; 487 rtc::scoped_ptr<IceRestartAnswerLatch> ice_restart_latch_;
486 488
487 rtc::scoped_ptr<WebRtcSessionDescriptionFactory> 489 rtc::scoped_ptr<WebRtcSessionDescriptionFactory>
488 webrtc_session_desc_factory_; 490 webrtc_session_desc_factory_;
489 491
490 // Member variables for caching global options. 492 // Member variables for caching global options.
491 cricket::AudioOptions audio_options_; 493 cricket::AudioOptions audio_options_;
492 cricket::VideoOptions video_options_; 494 cricket::VideoOptions video_options_;
493 MetricsObserverInterface* metrics_observer_; 495 MetricsObserverInterface* metrics_observer_;
494 496
495 // Declares the bundle policy for the WebRTCSession. 497 // Declares the bundle policy for the WebRTCSession.
496 PeerConnectionInterface::BundlePolicy bundle_policy_; 498 PeerConnectionInterface::BundlePolicy bundle_policy_;
497 499
498 // Declares the RTCP mux policy for the WebRTCSession. 500 // Declares the RTCP mux policy for the WebRTCSession.
499 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_; 501 PeerConnectionInterface::RtcpMuxPolicy rtcp_mux_policy_;
500 502
501 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession); 503 RTC_DISALLOW_COPY_AND_ASSIGN(WebRtcSession);
502 }; 504 };
503 } // namespace webrtc 505 } // namespace webrtc
504 506
505 #endif // WEBRTC_API_WEBRTCSESSION_H_ 507 #endif // WEBRTC_API_WEBRTCSESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698