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_MEDIA_STREAM_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 23 matching lines...) Expand all Loading... | |
34 class IpcNetworkManager; | 34 class IpcNetworkManager; |
35 class IpcPacketSocketFactory; | 35 class IpcPacketSocketFactory; |
36 class P2PSocketDispatcher; | 36 class P2PSocketDispatcher; |
37 } | 37 } |
38 | 38 |
39 namespace talk_base { | 39 namespace talk_base { |
40 class Thread; | 40 class Thread; |
41 } | 41 } |
42 | 42 |
43 namespace WebKit { | 43 namespace WebKit { |
44 class WebMediaStreamCenter; | |
45 class WebMediaStreamCenterClient; | |
44 class WebPeerConnectionHandler; | 46 class WebPeerConnectionHandler; |
45 class WebPeerConnectionHandlerClient; | 47 class WebPeerConnectionHandlerClient; |
46 } | 48 } |
47 | 49 |
50 class MediaStreamCenter; | |
48 class MediaStreamDispatcher; | 51 class MediaStreamDispatcher; |
49 class MediaStreamDependencyFactory; | 52 class MediaStreamDependencyFactory; |
50 class PeerConnectionHandler; | 53 class PeerConnectionHandler; |
51 class VideoCaptureImplManager; | 54 class VideoCaptureImplManager; |
52 class RTCVideoDecoder; | 55 class RTCVideoDecoder; |
53 | 56 |
54 // MediaStreamImpl is a delegate for the Media Stream API messages used by | 57 // MediaStreamImpl is a delegate for the Media Stream API messages used by |
55 // WebKit. It ties together WebKit, native PeerConnection in libjingle and | 58 // WebKit. It ties together WebKit, native PeerConnection in libjingle and |
56 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) | 59 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) |
57 // in the browser process. It must be created, called and destroyed on the | 60 // in the browser process. It must be created, called and destroyed on the |
58 // render thread. | 61 // render thread. |
59 class CONTENT_EXPORT MediaStreamImpl | 62 class CONTENT_EXPORT MediaStreamImpl |
60 : NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), | 63 : NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), |
61 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), | 64 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), |
62 public MediaStreamDispatcherEventHandler, | 65 public MediaStreamDispatcherEventHandler, |
63 NON_EXPORTED_BASE(public base::NonThreadSafe), | 66 NON_EXPORTED_BASE(public base::NonThreadSafe), |
64 public base::RefCountedThreadSafe<MediaStreamImpl> { | 67 public base::RefCountedThreadSafe<MediaStreamImpl> { |
65 public: | 68 public: |
66 MediaStreamImpl( | 69 MediaStreamImpl( |
67 MediaStreamDispatcher* media_stream_dispatcher, | 70 MediaStreamDispatcher* media_stream_dispatcher, |
68 content::P2PSocketDispatcher* p2p_socket_dispatcher, | 71 content::P2PSocketDispatcher* p2p_socket_dispatcher, |
69 VideoCaptureImplManager* vc_manager, | 72 VideoCaptureImplManager* vc_manager, |
70 MediaStreamDependencyFactory* dependency_factory); | 73 MediaStreamDependencyFactory* dependency_factory); |
71 virtual ~MediaStreamImpl(); | 74 virtual ~MediaStreamImpl(); |
72 | 75 |
73 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( | 76 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( |
74 WebKit::WebPeerConnectionHandlerClient* client); | 77 WebKit::WebPeerConnectionHandlerClient* client); |
78 virtual WebKit::WebMediaStreamCenter* CreateMediaStreamCenter( | |
79 WebKit::WebMediaStreamCenterClient* client); | |
75 virtual void ClosePeerConnection(); | 80 virtual void ClosePeerConnection(); |
76 virtual webrtc::MediaStreamTrackInterface* GetLocalMediaStreamTrack( | 81 virtual webrtc::MediaStreamTrackInterface* GetLocalMediaStreamTrack( |
77 const std::string& label); | 82 const std::string& label); |
78 | 83 |
79 // WebKit::WebUserMediaClient implementation | 84 // WebKit::WebUserMediaClient implementation |
80 virtual void requestUserMedia( | 85 virtual void requestUserMedia( |
81 const WebKit::WebUserMediaRequest& user_media_request, | 86 const WebKit::WebUserMediaRequest& user_media_request, |
82 const WebKit::WebVector<WebKit::WebMediaStreamSource>& | 87 const WebKit::WebVector<WebKit::WebMediaStreamSource>& |
83 media_stream_source_vector) OVERRIDE; | 88 media_stream_source_vector) OVERRIDE; |
84 virtual void cancelUserMediaRequest( | 89 virtual void cancelUserMediaRequest( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 | 156 |
152 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; | 157 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; |
153 | 158 |
154 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 159 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
155 | 160 |
156 // peer_connection_handler_ is a weak reference, owned by WebKit. It's valid | 161 // peer_connection_handler_ is a weak reference, owned by WebKit. It's valid |
157 // until stop is called on it (which will call ClosePeerConnection on us). | 162 // until stop is called on it (which will call ClosePeerConnection on us). |
158 // TODO(grunell): Support several PeerConnectionsHandlers. | 163 // TODO(grunell): Support several PeerConnectionsHandlers. |
159 PeerConnectionHandler* peer_connection_handler_; | 164 PeerConnectionHandler* peer_connection_handler_; |
160 | 165 |
166 // media_stream_center_ is a weak reference, owned by WebKit. It's valid for | |
piman
2012/02/08 01:52:24
"weak reference" suggests base::WeakPtr, which thi
tommyw
2012/02/08 13:14:18
Done.
| |
167 // the lifetime of RenderView. | |
168 MediaStreamCenter* media_stream_center_; | |
169 | |
161 // We keep a list of the generated local tracks, so that we can add capture | 170 // We keep a list of the generated local tracks, so that we can add capture |
162 // devices when generated and also use them for recording. | 171 // devices when generated and also use them for recording. |
163 typedef talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface> | 172 typedef talk_base::scoped_refptr<webrtc::MediaStreamTrackInterface> |
164 MediaStreamTrackPtr; | 173 MediaStreamTrackPtr; |
165 typedef std::map<std::string, MediaStreamTrackPtr> MediaStreamTrackPtrMap; | 174 typedef std::map<std::string, MediaStreamTrackPtr> MediaStreamTrackPtrMap; |
166 MediaStreamTrackPtrMap local_tracks_; | 175 MediaStreamTrackPtrMap local_tracks_; |
167 | 176 |
168 talk_base::scoped_refptr<VideoRendererWrapper> video_renderer_; | 177 talk_base::scoped_refptr<VideoRendererWrapper> video_renderer_; |
169 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 178 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
170 | 179 |
171 // PeerConnection threads. signaling_thread_ is created from the | 180 // PeerConnection threads. signaling_thread_ is created from the |
172 // "current" chrome thread. | 181 // "current" chrome thread. |
173 talk_base::Thread* signaling_thread_; | 182 talk_base::Thread* signaling_thread_; |
174 talk_base::Thread* worker_thread_; | 183 talk_base::Thread* worker_thread_; |
175 base::Thread chrome_worker_thread_; | 184 base::Thread chrome_worker_thread_; |
176 | 185 |
177 static int next_request_id_; | 186 static int next_request_id_; |
178 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap; | 187 typedef std::map<int, WebKit::WebUserMediaRequest> MediaRequestMap; |
179 MediaRequestMap user_media_requests_; | 188 MediaRequestMap user_media_requests_; |
180 | 189 |
181 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 190 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
182 }; | 191 }; |
183 | 192 |
184 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 193 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
OLD | NEW |