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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // messages going between WebKit and native PeerConnection in libjingle. It's | 84 // messages going between WebKit and native PeerConnection in libjingle. It's |
85 // owned by WebKit. | 85 // owned by WebKit. |
86 // WebKit calls all of these methods on the main render thread. | 86 // WebKit calls all of these methods on the main render thread. |
87 // Callbacks to the webrtc::PeerConnectionObserver implementation also occur on | 87 // Callbacks to the webrtc::PeerConnectionObserver implementation also occur on |
88 // the main render thread. | 88 // the main render thread. |
89 class CONTENT_EXPORT RTCPeerConnectionHandler | 89 class CONTENT_EXPORT RTCPeerConnectionHandler |
90 : NON_EXPORTED_BASE(public blink::WebRTCPeerConnectionHandler) { | 90 : NON_EXPORTED_BASE(public blink::WebRTCPeerConnectionHandler) { |
91 public: | 91 public: |
92 RTCPeerConnectionHandler( | 92 RTCPeerConnectionHandler( |
93 blink::WebRTCPeerConnectionHandlerClient* client, | 93 blink::WebRTCPeerConnectionHandlerClient* client, |
94 PeerConnectionDependencyFactory* dependency_factory, | 94 PeerConnectionDependencyFactory* dependency_factory); |
95 const scoped_refptr<base::SingleThreadTaskRunner>& signaling_thread); | |
96 virtual ~RTCPeerConnectionHandler(); | 95 virtual ~RTCPeerConnectionHandler(); |
97 | 96 |
98 // Destroy all existing RTCPeerConnectionHandler objects. | 97 // Destroy all existing RTCPeerConnectionHandler objects. |
99 static void DestructAllHandlers(); | 98 static void DestructAllHandlers(); |
100 | 99 |
101 static void ConvertOfferOptionsToConstraints( | 100 static void ConvertOfferOptionsToConstraints( |
102 const blink::WebRTCOfferOptions& options, | 101 const blink::WebRTCOfferOptions& options, |
103 RTCMediaConstraints* output); | 102 RTCMediaConstraints* output); |
104 | 103 |
105 void associateWithFrame(blink::WebFrame* frame); | 104 void associateWithFrame(blink::WebFrame* frame); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 const scoped_refptr<webrtc::MediaStreamInterface>& stream); | 196 const scoped_refptr<webrtc::MediaStreamInterface>& stream); |
198 void OnDataChannel(scoped_ptr<RtcDataChannelHandler> handler); | 197 void OnDataChannel(scoped_ptr<RtcDataChannelHandler> handler); |
199 void OnIceCandidate(const std::string& sdp, const std::string& sdp_mid, | 198 void OnIceCandidate(const std::string& sdp, const std::string& sdp_mid, |
200 int sdp_mline_index, int component, int address_family); | 199 int sdp_mline_index, int component, int address_family); |
201 | 200 |
202 private: | 201 private: |
203 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( | 202 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( |
204 const std::string& sdp, const std::string& type, | 203 const std::string& sdp, const std::string& type, |
205 webrtc::SdpParseError* error); | 204 webrtc::SdpParseError* error); |
206 | 205 |
| 206 // Virtual to allow mocks to override. |
| 207 virtual scoped_refptr<base::SingleThreadTaskRunner> signaling_thread() const; |
| 208 |
| 209 void RunSynchronousClosureOnSignalingThread(const base::Closure& closure, |
| 210 const char* trace_event_name); |
| 211 |
207 base::ThreadChecker thread_checker_; | 212 base::ThreadChecker thread_checker_; |
208 | 213 |
209 // |client_| is a weak pointer, and is valid until stop() has returned. | 214 // |client_| is a weak pointer, and is valid until stop() has returned. |
210 blink::WebRTCPeerConnectionHandlerClient* client_; | 215 blink::WebRTCPeerConnectionHandlerClient* client_; |
211 | 216 |
212 // |dependency_factory_| is a raw pointer, and is valid for the lifetime of | 217 // |dependency_factory_| is a raw pointer, and is valid for the lifetime of |
213 // RenderThreadImpl. | 218 // RenderThreadImpl. |
214 PeerConnectionDependencyFactory* const dependency_factory_; | 219 PeerConnectionDependencyFactory* const dependency_factory_; |
215 | 220 |
216 blink::WebFrame* frame_; | 221 blink::WebFrame* frame_; |
217 | 222 |
218 // Libjingle's signaling thread. | |
219 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_; | |
220 | |
221 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; | 223 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; |
222 | 224 |
223 base::WeakPtr<PeerConnectionTracker> peer_connection_tracker_; | 225 base::WeakPtr<PeerConnectionTracker> peer_connection_tracker_; |
224 | 226 |
225 MediaStreamTrackMetrics track_metrics_; | 227 MediaStreamTrackMetrics track_metrics_; |
226 | 228 |
227 // Counter for a UMA stat reported at destruction time. | 229 // Counter for a UMA stat reported at destruction time. |
228 int num_data_channels_created_; | 230 int num_data_channels_created_; |
229 | 231 |
230 // Counter for number of IPv4 and IPv6 local candidates. | 232 // Counter for number of IPv4 and IPv6 local candidates. |
(...skipping 10 matching lines...) Expand all Loading... |
241 scoped_refptr<webrtc::UMAObserver> uma_observer_; | 243 scoped_refptr<webrtc::UMAObserver> uma_observer_; |
242 base::TimeTicks ice_connection_checking_start_; | 244 base::TimeTicks ice_connection_checking_start_; |
243 base::WeakPtrFactory<RTCPeerConnectionHandler> weak_factory_; | 245 base::WeakPtrFactory<RTCPeerConnectionHandler> weak_factory_; |
244 | 246 |
245 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); | 247 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); |
246 }; | 248 }; |
247 | 249 |
248 } // namespace content | 250 } // namespace content |
249 | 251 |
250 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ | 252 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
OLD | NEW |