| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const scoped_refptr<webrtc::MediaStreamInterface>& stream); | 197 const scoped_refptr<webrtc::MediaStreamInterface>& stream); |
| 198 void OnDataChannel(scoped_ptr<RtcDataChannelHandler> handler); | 198 void OnDataChannel(scoped_ptr<RtcDataChannelHandler> handler); |
| 199 void OnIceCandidate(const std::string& sdp, const std::string& sdp_mid, | 199 void OnIceCandidate(const std::string& sdp, const std::string& sdp_mid, |
| 200 int sdp_mline_index, int component, int address_family); | 200 int sdp_mline_index, int component, int address_family); |
| 201 | 201 |
| 202 private: | 202 private: |
| 203 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( | 203 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( |
| 204 const std::string& sdp, const std::string& type, | 204 const std::string& sdp, const std::string& type, |
| 205 webrtc::SdpParseError* error); | 205 webrtc::SdpParseError* error); |
| 206 | 206 |
| 207 // Report to UMA whether an IceConnectionState has occurred. It only records |
| 208 // the first occurrence of a given state. |
| 209 void ReportICEState( |
| 210 webrtc::PeerConnectionInterface::IceConnectionState new_state); |
| 211 |
| 212 // Reset UMA related members to the initial state. This is invoked at the |
| 213 // constructor as well as after Ice Restart. |
| 214 void ResetUMAStats(); |
| 215 |
| 207 // Virtual to allow mocks to override. | 216 // Virtual to allow mocks to override. |
| 208 virtual scoped_refptr<base::SingleThreadTaskRunner> signaling_thread() const; | 217 virtual scoped_refptr<base::SingleThreadTaskRunner> signaling_thread() const; |
| 209 | 218 |
| 210 void RunSynchronousClosureOnSignalingThread(const base::Closure& closure, | 219 void RunSynchronousClosureOnSignalingThread(const base::Closure& closure, |
| 211 const char* trace_event_name); | 220 const char* trace_event_name); |
| 212 | 221 |
| 213 base::ThreadChecker thread_checker_; | 222 base::ThreadChecker thread_checker_; |
| 214 | 223 |
| 215 // |client_| is a weak pointer, and is valid until stop() has returned. | 224 // |client_| is a weak pointer, and is valid until stop() has returned. |
| 216 blink::WebRTCPeerConnectionHandlerClient* client_; | 225 blink::WebRTCPeerConnectionHandlerClient* client_; |
| 217 | 226 |
| 218 // |dependency_factory_| is a raw pointer, and is valid for the lifetime of | 227 // |dependency_factory_| is a raw pointer, and is valid for the lifetime of |
| 219 // RenderThreadImpl. | 228 // RenderThreadImpl. |
| 220 PeerConnectionDependencyFactory* const dependency_factory_; | 229 PeerConnectionDependencyFactory* const dependency_factory_; |
| 221 | 230 |
| 222 blink::WebFrame* frame_; | 231 blink::WebFrame* frame_ = nullptr; |
| 223 | 232 |
| 224 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; | 233 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; |
| 225 | 234 |
| 226 base::WeakPtr<PeerConnectionTracker> peer_connection_tracker_; | 235 base::WeakPtr<PeerConnectionTracker> peer_connection_tracker_; |
| 227 | 236 |
| 228 MediaStreamTrackMetrics track_metrics_; | 237 MediaStreamTrackMetrics track_metrics_; |
| 229 | 238 |
| 230 // Counter for a UMA stat reported at destruction time. | 239 // Counter for a UMA stat reported at destruction time. |
| 231 int num_data_channels_created_; | 240 int num_data_channels_created_ = 0; |
| 232 | 241 |
| 233 // Counter for number of IPv4 and IPv6 local candidates. | 242 // Counter for number of IPv4 and IPv6 local candidates. |
| 234 int num_local_candidates_ipv4_; | 243 int num_local_candidates_ipv4_ = 0; |
| 235 int num_local_candidates_ipv6_; | 244 int num_local_candidates_ipv6_ = 0; |
| 236 | 245 |
| 237 // To make sure the observer is released after the native_peer_connection_, | 246 // To make sure the observer is released after the native_peer_connection_, |
| 238 // it has to come first. | 247 // it has to come first. |
| 239 scoped_refptr<Observer> peer_connection_observer_; | 248 scoped_refptr<Observer> peer_connection_observer_; |
| 240 | 249 |
| 241 // |native_peer_connection_| is the libjingle native PeerConnection object. | 250 // |native_peer_connection_| is the libjingle native PeerConnection object. |
| 242 scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection_; | 251 scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection_; |
| 243 | 252 |
| 244 typedef std::map<webrtc::MediaStreamInterface*, | 253 typedef std::map<webrtc::MediaStreamInterface*, |
| 245 content::RemoteMediaStreamImpl*> RemoteStreamMap; | 254 content::RemoteMediaStreamImpl*> RemoteStreamMap; |
| 246 RemoteStreamMap remote_streams_; | 255 RemoteStreamMap remote_streams_; |
| 247 scoped_refptr<webrtc::UMAObserver> uma_observer_; | 256 scoped_refptr<webrtc::UMAObserver> uma_observer_; |
| 248 base::TimeTicks ice_connection_checking_start_; | 257 base::TimeTicks ice_connection_checking_start_; |
| 258 |
| 259 // Track which ICE Connection state that this PeerConnection has gone through. |
| 260 bool ice_state_seen_[webrtc::PeerConnectionInterface::kIceConnectionMax] = {}; |
| 261 |
| 249 base::WeakPtrFactory<RTCPeerConnectionHandler> weak_factory_; | 262 base::WeakPtrFactory<RTCPeerConnectionHandler> weak_factory_; |
| 250 | 263 |
| 251 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); | 264 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); |
| 252 }; | 265 }; |
| 253 | 266 |
| 254 } // namespace content | 267 } // namespace content |
| 255 | 268 |
| 256 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ | 269 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
| OLD | NEW |