OLD | NEW |
---|---|
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 // It uses MediaStreamSignaling and WebRtcSession to implement | 51 // It uses MediaStreamSignaling and WebRtcSession to implement |
52 // the PeerConnection functionality. | 52 // the PeerConnection functionality. |
53 class PeerConnection : public PeerConnectionInterface, | 53 class PeerConnection : public PeerConnectionInterface, |
54 public MediaStreamSignalingObserver, | 54 public MediaStreamSignalingObserver, |
55 public IceObserver, | 55 public IceObserver, |
56 public rtc::MessageHandler, | 56 public rtc::MessageHandler, |
57 public sigslot::has_slots<> { | 57 public sigslot::has_slots<> { |
58 public: | 58 public: |
59 explicit PeerConnection(PeerConnectionFactory* factory); | 59 explicit PeerConnection(PeerConnectionFactory* factory); |
60 | 60 |
61 // This method takes the ownership of |dtls_identity_service|. | |
tommi (sloooow) - chröme
2015/08/18 14:49:35
dtls_identity_store?
| |
61 bool Initialize( | 62 bool Initialize( |
62 const PeerConnectionInterface::RTCConfiguration& configuration, | 63 const PeerConnectionInterface::RTCConfiguration& configuration, |
63 const MediaConstraintsInterface* constraints, | 64 const MediaConstraintsInterface* constraints, |
64 PortAllocatorFactoryInterface* allocator_factory, | 65 PortAllocatorFactoryInterface* allocator_factory, |
65 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 66 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
66 PeerConnectionObserver* observer); | 67 PeerConnectionObserver* observer); |
68 bool Initialize( | |
69 const PeerConnectionInterface::RTCConfiguration& configuration, | |
70 const MediaConstraintsInterface* constraints, | |
71 PortAllocatorFactoryInterface* allocator_factory, | |
72 const rtc::scoped_refptr<DtlsCertificate>& certificate, | |
73 PeerConnectionObserver* observer); | |
67 virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams(); | 74 virtual rtc::scoped_refptr<StreamCollectionInterface> local_streams(); |
68 virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams(); | 75 virtual rtc::scoped_refptr<StreamCollectionInterface> remote_streams(); |
69 virtual bool AddStream(MediaStreamInterface* local_stream); | 76 virtual bool AddStream(MediaStreamInterface* local_stream); |
70 virtual void RemoveStream(MediaStreamInterface* local_stream); | 77 virtual void RemoveStream(MediaStreamInterface* local_stream); |
71 | 78 |
72 virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( | 79 virtual rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender( |
73 AudioTrackInterface* track); | 80 AudioTrackInterface* track); |
74 | 81 |
75 virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( | 82 virtual rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( |
76 const std::string& label, | 83 const std::string& label, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 virtual bool AddIceCandidate(const IceCandidateInterface* candidate); | 116 virtual bool AddIceCandidate(const IceCandidateInterface* candidate); |
110 | 117 |
111 virtual void RegisterUMAObserver(UMAObserver* observer); | 118 virtual void RegisterUMAObserver(UMAObserver* observer); |
112 | 119 |
113 virtual void Close(); | 120 virtual void Close(); |
114 | 121 |
115 protected: | 122 protected: |
116 virtual ~PeerConnection(); | 123 virtual ~PeerConnection(); |
117 | 124 |
118 private: | 125 private: |
126 // Initialize helper function. Initializes everything necessary by the peer | |
127 // connection except |session_|. The |session_| is created and ice observer | |
128 // and OnSessionStateChange registered, but the |session_|->Initialize call | |
129 // necessary and sufficient to complete initialization is not performed here. | |
130 bool InitializeInternal( | |
131 const PeerConnectionInterface::RTCConfiguration& configuration, | |
132 const MediaConstraintsInterface* constraints, | |
133 PortAllocatorFactoryInterface* allocator_factory, | |
134 PeerConnectionObserver* observer); | |
135 | |
119 // Implements MessageHandler. | 136 // Implements MessageHandler. |
120 virtual void OnMessage(rtc::Message* msg); | 137 virtual void OnMessage(rtc::Message* msg); |
121 | 138 |
122 // Implements MediaStreamSignalingObserver. | 139 // Implements MediaStreamSignalingObserver. |
123 void OnAddRemoteStream(MediaStreamInterface* stream) override; | 140 void OnAddRemoteStream(MediaStreamInterface* stream) override; |
124 void OnRemoveRemoteStream(MediaStreamInterface* stream) override; | 141 void OnRemoveRemoteStream(MediaStreamInterface* stream) override; |
125 void OnAddDataChannel(DataChannelInterface* data_channel) override; | 142 void OnAddDataChannel(DataChannelInterface* data_channel) override; |
126 void OnAddRemoteAudioTrack(MediaStreamInterface* stream, | 143 void OnAddRemoteAudioTrack(MediaStreamInterface* stream, |
127 AudioTrackInterface* audio_track, | 144 AudioTrackInterface* audio_track, |
128 uint32 ssrc) override; | 145 uint32 ssrc) override; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_; | 204 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_; |
188 rtc::scoped_ptr<WebRtcSession> session_; | 205 rtc::scoped_ptr<WebRtcSession> session_; |
189 rtc::scoped_ptr<MediaStreamSignaling> mediastream_signaling_; | 206 rtc::scoped_ptr<MediaStreamSignaling> mediastream_signaling_; |
190 rtc::scoped_ptr<MediaStreamHandlerContainer> stream_handler_container_; | 207 rtc::scoped_ptr<MediaStreamHandlerContainer> stream_handler_container_; |
191 rtc::scoped_ptr<StatsCollector> stats_; | 208 rtc::scoped_ptr<StatsCollector> stats_; |
192 }; | 209 }; |
193 | 210 |
194 } // namespace webrtc | 211 } // namespace webrtc |
195 | 212 |
196 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ | 213 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ |
OLD | NEW |