OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
6 #define CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 static void ConvertOfferOptionsToConstraints( | 101 static void ConvertOfferOptionsToConstraints( |
102 const blink::WebRTCOfferOptions& options, | 102 const blink::WebRTCOfferOptions& options, |
103 RTCMediaConstraints* output); | 103 RTCMediaConstraints* output); |
104 | 104 |
105 void associateWithFrame(blink::WebFrame* frame); | 105 void associateWithFrame(blink::WebFrame* frame); |
106 | 106 |
107 // Initialize method only used for unit test. | 107 // Initialize method only used for unit test. |
108 bool InitializeForTest( | 108 bool InitializeForTest( |
109 const blink::WebRTCConfiguration& server_configuration, | 109 const blink::WebRTCConfiguration& server_configuration, |
110 const blink::WebMediaConstraints& options, | 110 const blink::WebMediaConstraints& options, |
111 PeerConnectionTracker* peer_connection_tracker); | 111 const base::WeakPtr<PeerConnectionTracker>& peer_connection_tracker); |
112 | 112 |
113 // blink::WebRTCPeerConnectionHandler implementation | 113 // blink::WebRTCPeerConnectionHandler implementation |
114 virtual bool initialize( | 114 virtual bool initialize( |
115 const blink::WebRTCConfiguration& server_configuration, | 115 const blink::WebRTCConfiguration& server_configuration, |
116 const blink::WebMediaConstraints& options) override; | 116 const blink::WebMediaConstraints& options) override; |
117 | 117 |
118 virtual void createOffer( | 118 virtual void createOffer( |
119 const blink::WebRTCSessionDescriptionRequest& request, | 119 const blink::WebRTCSessionDescriptionRequest& request, |
120 const blink::WebMediaConstraints& options) override; | 120 const blink::WebMediaConstraints& options) override; |
121 virtual void createOffer( | 121 virtual void createOffer( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Asynchronously calls native_peer_connection_->getStats on the signaling | 170 // Asynchronously calls native_peer_connection_->getStats on the signaling |
171 // thread. If the |track_id| is empty, the |track_type| parameter is ignored. | 171 // thread. If the |track_id| is empty, the |track_type| parameter is ignored. |
172 void GetStats(webrtc::StatsObserver* observer, | 172 void GetStats(webrtc::StatsObserver* observer, |
173 webrtc::PeerConnectionInterface::StatsOutputLevel level, | 173 webrtc::PeerConnectionInterface::StatsOutputLevel level, |
174 const std::string& track_id, | 174 const std::string& track_id, |
175 blink::WebMediaStreamSource::Type track_type); | 175 blink::WebMediaStreamSource::Type track_type); |
176 | 176 |
177 // Tells the |client_| to close RTCPeerConnection. | 177 // Tells the |client_| to close RTCPeerConnection. |
178 void CloseClientPeerConnection(); | 178 void CloseClientPeerConnection(); |
179 | 179 |
180 PeerConnectionTracker* peer_connection_tracker(); | |
181 | |
182 protected: | 180 protected: |
183 webrtc::PeerConnectionInterface* native_peer_connection() { | 181 webrtc::PeerConnectionInterface* native_peer_connection() { |
184 return native_peer_connection_.get(); | 182 return native_peer_connection_.get(); |
185 } | 183 } |
186 | 184 |
187 class Observer; | 185 class Observer; |
188 friend class Observer; | 186 friend class Observer; |
189 | 187 |
190 void OnSignalingChange( | 188 void OnSignalingChange( |
191 webrtc::PeerConnectionInterface::SignalingState new_state); | 189 webrtc::PeerConnectionInterface::SignalingState new_state); |
(...skipping 23 matching lines...) Expand all Loading... |
215 // RenderThreadImpl. | 213 // RenderThreadImpl. |
216 PeerConnectionDependencyFactory* const dependency_factory_; | 214 PeerConnectionDependencyFactory* const dependency_factory_; |
217 | 215 |
218 blink::WebFrame* frame_; | 216 blink::WebFrame* frame_; |
219 | 217 |
220 // Libjingle's signaling thread. | 218 // Libjingle's signaling thread. |
221 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_; | 219 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_; |
222 | 220 |
223 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; | 221 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; |
224 | 222 |
225 PeerConnectionTracker* peer_connection_tracker_; | 223 base::WeakPtr<PeerConnectionTracker> peer_connection_tracker_; |
226 | 224 |
227 MediaStreamTrackMetrics track_metrics_; | 225 MediaStreamTrackMetrics track_metrics_; |
228 | 226 |
229 // Counter for a UMA stat reported at destruction time. | 227 // Counter for a UMA stat reported at destruction time. |
230 int num_data_channels_created_; | 228 int num_data_channels_created_; |
231 | 229 |
232 // Counter for number of IPv4 and IPv6 local candidates. | 230 // Counter for number of IPv4 and IPv6 local candidates. |
233 int num_local_candidates_ipv4_; | 231 int num_local_candidates_ipv4_; |
234 int num_local_candidates_ipv6_; | 232 int num_local_candidates_ipv6_; |
235 | 233 |
236 // |native_peer_connection_| is the libjingle native PeerConnection object. | 234 // |native_peer_connection_| is the libjingle native PeerConnection object. |
237 scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection_; | 235 scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection_; |
238 scoped_refptr<Observer> peer_connection_observer_; | 236 scoped_refptr<Observer> peer_connection_observer_; |
239 | 237 |
240 typedef std::map<webrtc::MediaStreamInterface*, | 238 typedef std::map<webrtc::MediaStreamInterface*, |
241 content::RemoteMediaStreamImpl*> RemoteStreamMap; | 239 content::RemoteMediaStreamImpl*> RemoteStreamMap; |
242 RemoteStreamMap remote_streams_; | 240 RemoteStreamMap remote_streams_; |
243 scoped_refptr<webrtc::UMAObserver> uma_observer_; | 241 scoped_refptr<webrtc::UMAObserver> uma_observer_; |
244 base::TimeTicks ice_connection_checking_start_; | 242 base::TimeTicks ice_connection_checking_start_; |
245 base::WeakPtrFactory<RTCPeerConnectionHandler> weak_factory_; | 243 base::WeakPtrFactory<RTCPeerConnectionHandler> weak_factory_; |
246 | 244 |
247 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); | 245 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); |
248 }; | 246 }; |
249 | 247 |
250 } // namespace content | 248 } // namespace content |
251 | 249 |
252 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ | 250 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
OLD | NEW |