| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 namespace WebKit { | 47 namespace WebKit { |
| 48 class WebFrame; | 48 class WebFrame; |
| 49 class WebMediaStreamComponent; | 49 class WebMediaStreamComponent; |
| 50 class WebMediaStreamDescriptor; | 50 class WebMediaStreamDescriptor; |
| 51 class WebPeerConnection00Handler; | 51 class WebPeerConnection00Handler; |
| 52 class WebPeerConnection00HandlerClient; | 52 class WebPeerConnection00HandlerClient; |
| 53 class WebPeerConnectionHandler; | 53 class WebPeerConnectionHandler; |
| 54 class WebPeerConnectionHandlerClient; | 54 class WebPeerConnectionHandlerClient; |
| 55 } | 55 } |
| 56 | 56 |
| 57 class AudioDeviceFactoryInterface; |
| 57 class MediaStreamDispatcher; | 58 class MediaStreamDispatcher; |
| 58 class MediaStreamDependencyFactory; | 59 class MediaStreamDependencyFactory; |
| 59 class PeerConnectionHandlerBase; | 60 class PeerConnectionHandlerBase; |
| 60 class VideoCaptureImplManager; | 61 class VideoCaptureImplManager; |
| 61 class RTCVideoDecoder; | 62 class RTCVideoDecoder; |
| 62 | 63 |
| 63 // MediaStreamImpl is a delegate for the Media Stream API messages used by | 64 // MediaStreamImpl is a delegate for the Media Stream API messages used by |
| 64 // WebKit. It ties together WebKit, native PeerConnection in libjingle and | 65 // WebKit. It ties together WebKit, native PeerConnection in libjingle and |
| 65 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) | 66 // MediaStreamManager (via MediaStreamDispatcher and MediaStreamDispatcherHost) |
| 66 // in the browser process. It must be created, called and destroyed on the | 67 // in the browser process. It must be created, called and destroyed on the |
| 67 // render thread. | 68 // render thread. |
| 68 // MediaStreamImpl have weak pointers to a P2PSocketDispatcher and a | 69 // MediaStreamImpl have weak pointers to a P2PSocketDispatcher and a |
| 69 // MediaStreamDispatcher. These objects are also RenderViewObservers. | 70 // MediaStreamDispatcher. These objects are also RenderViewObservers. |
| 70 // MediaStreamImpl must be deleted before the P2PSocketDispatcher. | 71 // MediaStreamImpl must be deleted before the P2PSocketDispatcher. |
| 71 class CONTENT_EXPORT MediaStreamImpl | 72 class CONTENT_EXPORT MediaStreamImpl |
| 72 : public content::RenderViewObserver, | 73 : public content::RenderViewObserver, |
| 73 NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), | 74 NON_EXPORTED_BASE(public WebKit::WebUserMediaClient), |
| 74 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), | 75 NON_EXPORTED_BASE(public webkit_media::MediaStreamClient), |
| 75 public MediaStreamDispatcherEventHandler, | 76 public MediaStreamDispatcherEventHandler, |
| 76 public base::SupportsWeakPtr<MediaStreamImpl>, | 77 public base::SupportsWeakPtr<MediaStreamImpl>, |
| 77 NON_EXPORTED_BASE(public content::P2PSocketDispatcherDestructionObserver), | 78 NON_EXPORTED_BASE(public content::P2PSocketDispatcherDestructionObserver), |
| 78 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 79 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 79 public: | 80 public: |
| 80 MediaStreamImpl( | 81 MediaStreamImpl( |
| 81 content::RenderView* render_view, | 82 content::RenderView* render_view, |
| 82 MediaStreamDispatcher* media_stream_dispatcher, | 83 MediaStreamDispatcher* media_stream_dispatcher, |
| 83 content::P2PSocketDispatcher* p2p_socket_dispatcher, | 84 content::P2PSocketDispatcher* p2p_socket_dispatcher, |
| 84 VideoCaptureImplManager* vc_manager, | 85 VideoCaptureImplManager* vc_manager, |
| 85 MediaStreamDependencyFactory* dependency_factory); | 86 MediaStreamDependencyFactory* dependency_factory, |
| 87 AudioDeviceFactoryInterface* audio_device_factory); |
| 86 virtual ~MediaStreamImpl(); | 88 virtual ~MediaStreamImpl(); |
| 87 | 89 |
| 88 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( | 90 virtual WebKit::WebPeerConnectionHandler* CreatePeerConnectionHandler( |
| 89 WebKit::WebPeerConnectionHandlerClient* client); | 91 WebKit::WebPeerConnectionHandlerClient* client); |
| 90 virtual WebKit::WebPeerConnection00Handler* CreatePeerConnectionHandlerJsep( | 92 virtual WebKit::WebPeerConnection00Handler* CreatePeerConnectionHandlerJsep( |
| 91 WebKit::WebPeerConnection00HandlerClient* client); | 93 WebKit::WebPeerConnection00HandlerClient* client); |
| 92 // Stops a local MediaStream by notifying the MediaStreamDispatcher that the | 94 // Stops a local MediaStream by notifying the MediaStreamDispatcher that the |
| 93 // stream no longer may be used. | 95 // stream no longer may be used. |
| 94 virtual void StopLocalMediaStream( | 96 virtual void StopLocalMediaStream( |
| 95 const WebKit::WebMediaStreamDescriptor& stream); | 97 const WebKit::WebMediaStreamDescriptor& stream); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; | 216 scoped_ptr<MediaStreamDependencyFactory> dependency_factory_; |
| 215 | 217 |
| 216 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's | 218 // media_stream_dispatcher_ is a weak reference, owned by RenderView. It's |
| 217 // valid for the lifetime of RenderView. | 219 // valid for the lifetime of RenderView. |
| 218 MediaStreamDispatcher* media_stream_dispatcher_; | 220 MediaStreamDispatcher* media_stream_dispatcher_; |
| 219 | 221 |
| 220 // p2p_socket_dispatcher_ is a weak reference, owned by RenderView. It's valid | 222 // p2p_socket_dispatcher_ is a weak reference, owned by RenderView. It's valid |
| 221 // for the lifetime of RenderView. | 223 // for the lifetime of RenderView. |
| 222 content::P2PSocketDispatcher* p2p_socket_dispatcher_; | 224 content::P2PSocketDispatcher* p2p_socket_dispatcher_; |
| 223 | 225 |
| 226 // audio_device_factory is a weak reference, owned by RenderView. It's valid |
| 227 // for the lifetime of RenderView. |
| 228 AudioDeviceFactoryInterface* audio_device_factory_; |
| 229 |
| 224 // We own network_manager_, must be deleted on the worker thread. | 230 // We own network_manager_, must be deleted on the worker thread. |
| 225 // The network manager uses |p2p_socket_dispatcher_|. | 231 // The network manager uses |p2p_socket_dispatcher_|. |
| 226 content::IpcNetworkManager* network_manager_; | 232 content::IpcNetworkManager* network_manager_; |
| 227 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; | 233 scoped_ptr<content::IpcPacketSocketFactory> socket_factory_; |
| 228 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 234 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
| 229 | 235 |
| 230 MediaRequestMap user_media_requests_; | 236 MediaRequestMap user_media_requests_; |
| 231 LocalNativeStreamMap local_media_streams_; | 237 LocalNativeStreamMap local_media_streams_; |
| 232 | 238 |
| 233 // PeerConnection threads. signaling_thread_ is created from the | 239 // PeerConnection threads. signaling_thread_ is created from the |
| 234 // "current" chrome thread. | 240 // "current" chrome thread. |
| 235 talk_base::Thread* signaling_thread_; | 241 talk_base::Thread* signaling_thread_; |
| 236 talk_base::Thread* worker_thread_; | 242 talk_base::Thread* worker_thread_; |
| 237 base::Thread chrome_worker_thread_; | 243 base::Thread chrome_worker_thread_; |
| 238 | 244 |
| 239 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); | 245 DISALLOW_COPY_AND_ASSIGN(MediaStreamImpl); |
| 240 }; | 246 }; |
| 241 | 247 |
| 242 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ | 248 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_IMPL_H_ |
| OLD | NEW |