| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // render thread. | 67 // render thread. |
| 68 // MediaStreamImpl have weak pointers to a P2PSocketDispatcher and a | 68 // MediaStreamImpl have weak pointers to a P2PSocketDispatcher and a |
| 69 // MediaStreamDispatcher. These objects are also RenderViewObservers. | 69 // MediaStreamDispatcher. These objects are also RenderViewObservers. |
| 70 // MediaStreamImpl must be deleted before the P2PSocketDispatcher. | 70 // MediaStreamImpl must be deleted before the P2PSocketDispatcher. |
| 71 class CONTENT_EXPORT MediaStreamImpl | 71 class CONTENT_EXPORT MediaStreamImpl |
| 72 : public content::RenderViewObserver, | 72 : public content::RenderViewObserver, |
| 73 NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), | 73 NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), |
| 74 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), | 74 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), |
| 75 public MediaStreamDispatcherEventHandler, | 75 public MediaStreamDispatcherEventHandler, |
| 76 public base::SupportsWeakPtr<MediaStreamImpl>, | 76 public base::SupportsWeakPtr<MediaStreamImpl>, |
| 77 NON_EXPORTED_BASE(public content::P2PSocketDispatcherDestructionObserver), | |
| 78 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 77 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 79 public: | 78 public: |
| 80 MediaStreamImpl( | 79 MediaStreamImpl( |
| 81 content::RenderView* render_view, | 80 content::RenderView* render_view, |
| 82 MediaStreamDispatcher* media_stream_dispatcher, | 81 MediaStreamDispatcher* media_stream_dispatcher, |
| 83 content::P2PSocketDispatcher* p2p_socket_dispatcher, | 82 content::P2PSocketDispatcher* p2p_socket_dispatcher, |
| 84 VideoCaptureImplManager* vc_manager, | 83 VideoCaptureImplManager* vc_manager, |
| 85 MediaStreamDependencyFactory* dependency_factory); | 84 MediaStreamDependencyFactory* dependency_factory); |
| 86 virtual ~MediaStreamImpl(); | 85 virtual ~MediaStreamImpl(); |
| 87 | 86 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE; | 128 virtual void OnDevicesEnumerationFailed(int request_id) OVERRIDE; |
| 130 virtual void OnDeviceOpened( | 129 virtual void OnDeviceOpened( |
| 131 int request_id, | 130 int request_id, |
| 132 const std::string& label, | 131 const std::string& label, |
| 133 const media_stream::StreamDeviceInfo& device_info) OVERRIDE; | 132 const media_stream::StreamDeviceInfo& device_info) OVERRIDE; |
| 134 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; | 133 virtual void OnDeviceOpenFailed(int request_id) OVERRIDE; |
| 135 | 134 |
| 136 // content::RenderViewObserver OVERRIDE | 135 // content::RenderViewObserver OVERRIDE |
| 137 virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; | 136 virtual void FrameWillClose(WebKit::WebFrame* frame) OVERRIDE; |
| 138 | 137 |
| 139 // content P2PSocketDispatcherDestructionObserver implementation. | |
| 140 // This is needed since all IpcNetworkManager must be deleted before the | |
| 141 // P2PSocketDispatcher is destroyed. MediaStreamImpl owns a IpcNetworkManager. | |
| 142 virtual void OnSocketDispatcherDestroyed() OVERRIDE; | |
| 143 | |
| 144 protected: | 138 protected: |
| 145 // This function is virtual for test purposes. A test can override this to | 139 // This function is virtual for test purposes. A test can override this to |
| 146 // test requesting local media streams. The function notifies WebKit that the | 140 // test requesting local media streams. The function notifies WebKit that the |
| 147 // |request| have completed and generated the MediaStream |stream|. | 141 // |request| have completed and generated the MediaStream |stream|. |
| 148 virtual void CompleteGetUserMediaRequest( | 142 virtual void CompleteGetUserMediaRequest( |
| 149 const WebKit::WebMediaStreamDescriptor& stream, | 143 const WebKit::WebMediaStreamDescriptor& stream, |
| 150 WebKit::WebUserMediaRequest* request); | 144 WebKit::WebUserMediaRequest* request); |
| 151 // This function is virtual for test purposes. | 145 // This function is virtual for test purposes. |
| 152 // Returns the WebKit representation of a MediaStream given an URL. | 146 // Returns the WebKit representation of a MediaStream given an URL. |
| 153 virtual WebKit::WebMediaStreamDescriptor GetMediaStream(const GURL& url); | 147 virtual WebKit::WebMediaStreamDescriptor GetMediaStream(const GURL& url); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 WebKit::WebFrame* frame, | 185 WebKit::WebFrame* frame, |
| 192 const WebKit::WebVector<WebKit::WebMediaStreamSource>& audio_sources, | 186 const WebKit::WebVector<WebKit::WebMediaStreamSource>& audio_sources, |
| 193 const WebKit::WebVector<WebKit::WebMediaStreamSource>& video_sources); | 187 const WebKit::WebVector<WebKit::WebMediaStreamSource>& video_sources); |
| 194 | 188 |
| 195 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; | 189 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; |
| 196 | 190 |
| 197 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's | 191 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's |
| 198 // valid for the lifetime of RenderView. | 192 // valid for the lifetime of RenderView. |
| 199 MediaStreamDispatcher* media_stream_dispatcher_; | 193 MediaStreamDispatcher* media_stream_dispatcher_; |
| 200 | 194 |
| 201 // p2p_socket_dispatcher_ is a weak reference, owned by RenderView. It's valid | 195 scoped_refptr<content::P2PSocketDispatcher> p2p_socket_dispatcher_; |
| 202 // for the lifetime of RenderView. | |
| 203 content::P2PSocketDispatcher* p2p_socket_dispatcher_; | |
| 204 | 196 |
| 205 // We own network_manager_, must be deleted on the worker thread. | 197 // We own network_manager_, must be deleted on the worker thread. |
| 206 // The network manager uses |p2p_socket_dispatcher_|. | 198 // The network manager uses |p2p_socket_dispatcher_|. |
| 207 content::IpcNetworkManager* network_manager_; | 199 content::IpcNetworkManager* network_manager_; |
| 208 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; | 200 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; |
| 209 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 201 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
| 210 | 202 |
| 211 MediaRequestMap user_media_requests_; | 203 MediaRequestMap user_media_requests_; |
| 212 LocalNativeStreamMap local_media_streams_; | 204 LocalNativeStreamMap local_media_streams_; |
| 213 | 205 |
| 214 // PeerConnection threads. signaling_thread_ is created from the | 206 // PeerConnection threads. signaling_thread_ is created from the |
| 215 // "current" chrome thread. | 207 // "current" chrome thread. |
| 216 talk_base::Thread* signaling_thread_; | 208 talk_base::Thread* signaling_thread_; |
| 217 talk_base::Thread* worker_thread_; | 209 talk_base::Thread* worker_thread_; |
| 218 base::Thread chrome_worker_thread_; | 210 base::Thread chrome_worker_thread_; |
| 219 | 211 |
| 220 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 212 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
| 221 }; | 213 }; |
| 222 | 214 |
| 223 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 215 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
| OLD | NEW |