| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 media::MessageLoopFactory* message_loop_factory); | 182 media::MessageLoopFactory* message_loop_factory); |
| 189 bool CreateNativeLocalMediaStream( | 183 bool CreateNativeLocalMediaStream( |
| 190 WebKit::WebMediaStreamDescriptor* description); | 184 WebKit::WebMediaStreamDescriptor* description); |
| 191 | 185 |
| 192 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; | 186 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; |
| 193 | 187 |
| 194 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's | 188 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's |
| 195 // valid for the lifetime of RenderView. | 189 // valid for the lifetime of RenderView. |
| 196 MediaStreamDispatcher* media_stream_dispatcher_; | 190 MediaStreamDispatcher* media_stream_dispatcher_; |
| 197 | 191 |
| 198 // p2p_socket_dispatcher_ is a weak reference, owned by RenderView. It's valid | 192 scoped_refptr<content::P2PSocketDispatcher> p2p_socket_dispatcher_; |
| 199 // for the lifetime of RenderView. | |
| 200 content::P2PSocketDispatcher* p2p_socket_dispatcher_; | |
| 201 | 193 |
| 202 // We own network_manager_, must be deleted on the worker thread. | 194 // We own network_manager_, must be deleted on the worker thread. |
| 203 // The network manager uses |p2p_socket_dispatcher_|. | 195 // The network manager uses |p2p_socket_dispatcher_|. |
| 204 content::IpcNetworkManager* network_manager_; | 196 content::IpcNetworkManager* network_manager_; |
| 205 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; | 197 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; |
| 206 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 198 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
| 207 | 199 |
| 208 MediaRequestMap user_media_requests_; | 200 MediaRequestMap user_media_requests_; |
| 209 LocalNativeStreamMap local_media_streams_; | 201 LocalNativeStreamMap local_media_streams_; |
| 210 | 202 |
| 211 // PeerConnection threads. signaling_thread_ is created from the | 203 // PeerConnection threads. signaling_thread_ is created from the |
| 212 // "current" chrome thread. | 204 // "current" chrome thread. |
| 213 talk_base::Thread* signaling_thread_; | 205 talk_base::Thread* signaling_thread_; |
| 214 talk_base::Thread* worker_thread_; | 206 talk_base::Thread* worker_thread_; |
| 215 base::Thread chrome_worker_thread_; | 207 base::Thread chrome_worker_thread_; |
| 216 | 208 |
| 217 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 209 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
| 218 }; | 210 }; |
| 219 | 211 |
| 220 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 212 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
| OLD | NEW |