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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/renderer/media/webrtc/media_stream_track_metrics.h" | 15 #include "content/renderer/media/webrtc/media_stream_track_metrics.h" |
16 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" | 16 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" |
17 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" | 17 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" |
18 #include "third_party/WebKit/public/platform/WebRTCStatsResponse.h" | 18 #include "third_party/WebKit/public/platform/WebRTCStatsResponse.h" |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 class WebFrame; | 21 class WebFrame; |
22 class WebRTCDataChannelHandler; | 22 class WebRTCDataChannelHandler; |
23 } | 23 } |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 class MediaStreamDependencyFactory; | 27 class PeerConnectionDependencyFactory; |
28 class PeerConnectionTracker; | 28 class PeerConnectionTracker; |
29 class RemoteMediaStreamImpl; | 29 class RemoteMediaStreamImpl; |
30 class WebRtcMediaStreamAdapter; | 30 class WebRtcMediaStreamAdapter; |
31 | 31 |
32 // Mockable wrapper for blink::WebRTCStatsResponse | 32 // Mockable wrapper for blink::WebRTCStatsResponse |
33 class CONTENT_EXPORT LocalRTCStatsResponse | 33 class CONTENT_EXPORT LocalRTCStatsResponse |
34 : public NON_EXPORTED_BASE(talk_base::RefCountInterface) { | 34 : public NON_EXPORTED_BASE(talk_base::RefCountInterface) { |
35 public: | 35 public: |
36 explicit LocalRTCStatsResponse(const blink::WebRTCStatsResponse& impl) | 36 explicit LocalRTCStatsResponse(const blink::WebRTCStatsResponse& impl) |
37 : impl_(impl) { | 37 : impl_(impl) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // owned by WebKit. | 78 // owned by WebKit. |
79 // WebKit calls all of these methods on the main render thread. | 79 // WebKit calls all of these methods on the main render thread. |
80 // Callbacks to the webrtc::PeerConnectionObserver implementation also occur on | 80 // Callbacks to the webrtc::PeerConnectionObserver implementation also occur on |
81 // the main render thread. | 81 // the main render thread. |
82 class CONTENT_EXPORT RTCPeerConnectionHandler | 82 class CONTENT_EXPORT RTCPeerConnectionHandler |
83 : NON_EXPORTED_BASE(public blink::WebRTCPeerConnectionHandler), | 83 : NON_EXPORTED_BASE(public blink::WebRTCPeerConnectionHandler), |
84 NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver) { | 84 NON_EXPORTED_BASE(public webrtc::PeerConnectionObserver) { |
85 public: | 85 public: |
86 RTCPeerConnectionHandler( | 86 RTCPeerConnectionHandler( |
87 blink::WebRTCPeerConnectionHandlerClient* client, | 87 blink::WebRTCPeerConnectionHandlerClient* client, |
88 MediaStreamDependencyFactory* dependency_factory); | 88 PeerConnectionDependencyFactory* dependency_factory); |
89 virtual ~RTCPeerConnectionHandler(); | 89 virtual ~RTCPeerConnectionHandler(); |
90 | 90 |
91 void associateWithFrame(blink::WebFrame* frame); | 91 void associateWithFrame(blink::WebFrame* frame); |
92 | 92 |
93 // Initialize method only used for unit test. | 93 // Initialize method only used for unit test. |
94 bool InitializeForTest( | 94 bool InitializeForTest( |
95 const blink::WebRTCConfiguration& server_configuration, | 95 const blink::WebRTCConfiguration& server_configuration, |
96 const blink::WebMediaConstraints& options, | 96 const blink::WebMediaConstraints& options, |
97 PeerConnectionTracker* peer_connection_tracker); | 97 PeerConnectionTracker* peer_connection_tracker); |
98 | 98 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 private: | 182 private: |
183 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( | 183 webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( |
184 const blink::WebRTCSessionDescription& description, | 184 const blink::WebRTCSessionDescription& description, |
185 webrtc::SdpParseError* error); | 185 webrtc::SdpParseError* error); |
186 | 186 |
187 // |client_| is a weak pointer, and is valid until stop() has returned. | 187 // |client_| is a weak pointer, and is valid until stop() has returned. |
188 blink::WebRTCPeerConnectionHandlerClient* client_; | 188 blink::WebRTCPeerConnectionHandlerClient* client_; |
189 | 189 |
190 // |dependency_factory_| is a raw pointer, and is valid for the lifetime of | 190 // |dependency_factory_| is a raw pointer, and is valid for the lifetime of |
191 // RenderThreadImpl. | 191 // RenderThreadImpl. |
192 MediaStreamDependencyFactory* dependency_factory_; | 192 PeerConnectionDependencyFactory* dependency_factory_; |
193 | 193 |
194 blink::WebFrame* frame_; | 194 blink::WebFrame* frame_; |
195 | 195 |
196 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; | 196 ScopedVector<WebRtcMediaStreamAdapter> local_streams_; |
197 | 197 |
198 PeerConnectionTracker* peer_connection_tracker_; | 198 PeerConnectionTracker* peer_connection_tracker_; |
199 | 199 |
200 MediaStreamTrackMetrics track_metrics_; | 200 MediaStreamTrackMetrics track_metrics_; |
201 | 201 |
202 // Counter for a UMA stat reported at destruction time. | 202 // Counter for a UMA stat reported at destruction time. |
203 int num_data_channels_created_; | 203 int num_data_channels_created_; |
204 | 204 |
205 // |native_peer_connection_| is the libjingle native PeerConnection object. | 205 // |native_peer_connection_| is the libjingle native PeerConnection object. |
206 scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection_; | 206 scoped_refptr<webrtc::PeerConnectionInterface> native_peer_connection_; |
207 | 207 |
208 typedef std::map<webrtc::MediaStreamInterface*, | 208 typedef std::map<webrtc::MediaStreamInterface*, |
209 content::RemoteMediaStreamImpl*> RemoteStreamMap; | 209 content::RemoteMediaStreamImpl*> RemoteStreamMap; |
210 RemoteStreamMap remote_streams_; | 210 RemoteStreamMap remote_streams_; |
211 | 211 |
212 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); | 212 DISALLOW_COPY_AND_ASSIGN(RTCPeerConnectionHandler); |
213 }; | 213 }; |
214 | 214 |
215 } // namespace content | 215 } // namespace content |
216 | 216 |
217 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ | 217 #endif // CONTENT_RENDERER_MEDIA_RTC_PEER_CONNECTION_HANDLER_H_ |
OLD | NEW |