| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class WebRTCPeerConnectionHandlerClient; | 43 class WebRTCPeerConnectionHandlerClient; |
| 44 } | 44 } |
| 45 | 45 |
| 46 namespace content { | 46 namespace content { |
| 47 | 47 |
| 48 class IpcNetworkManager; | 48 class IpcNetworkManager; |
| 49 class IpcPacketSocketFactory; | 49 class IpcPacketSocketFactory; |
| 50 class WebRtcAudioDeviceImpl; | 50 class WebRtcAudioDeviceImpl; |
| 51 class WebRtcLoggingHandlerImpl; | 51 class WebRtcLoggingHandlerImpl; |
| 52 class WebRtcLoggingMessageFilter; | 52 class WebRtcLoggingMessageFilter; |
| 53 class WebRtcVideoCapturerAdapter; | |
| 54 struct StreamDeviceInfo; | 53 struct StreamDeviceInfo; |
| 55 | 54 |
| 56 // Object factory for RTC PeerConnections. | 55 // Object factory for RTC PeerConnections. |
| 57 class CONTENT_EXPORT PeerConnectionDependencyFactory | 56 class CONTENT_EXPORT PeerConnectionDependencyFactory |
| 58 : NON_EXPORTED_BASE(base::MessageLoop::DestructionObserver), | 57 : NON_EXPORTED_BASE(base::MessageLoop::DestructionObserver), |
| 59 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 58 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 60 public: | 59 public: |
| 61 PeerConnectionDependencyFactory( | 60 PeerConnectionDependencyFactory( |
| 62 P2PSocketDispatcher* p2p_socket_dispatcher); | 61 P2PSocketDispatcher* p2p_socket_dispatcher); |
| 63 ~PeerConnectionDependencyFactory() override; | 62 ~PeerConnectionDependencyFactory() override; |
| 64 | 63 |
| 65 // Create a RTCPeerConnectionHandler object that implements the | 64 // Create a RTCPeerConnectionHandler object that implements the |
| 66 // WebKit WebRTCPeerConnectionHandler interface. | 65 // WebKit WebRTCPeerConnectionHandler interface. |
| 67 blink::WebRTCPeerConnectionHandler* CreateRTCPeerConnectionHandler( | 66 blink::WebRTCPeerConnectionHandler* CreateRTCPeerConnectionHandler( |
| 68 blink::WebRTCPeerConnectionHandlerClient* client); | 67 blink::WebRTCPeerConnectionHandlerClient* client); |
| 69 | 68 |
| 69 // Create a proxy object for a VideoTrackSource that makes sure it's called on |
| 70 // the correct threads. |
| 71 virtual scoped_refptr<webrtc::VideoTrackSourceInterface> |
| 72 CreateVideoTrackSourceProxy(webrtc::VideoTrackSourceInterface* source); |
| 73 |
| 70 // Asks the PeerConnection factory to create a Local MediaStream object. | 74 // Asks the PeerConnection factory to create a Local MediaStream object. |
| 71 virtual scoped_refptr<webrtc::MediaStreamInterface> | 75 virtual scoped_refptr<webrtc::MediaStreamInterface> |
| 72 CreateLocalMediaStream(const std::string& label); | 76 CreateLocalMediaStream(const std::string& label); |
| 73 | 77 |
| 74 // Creates an implementation of a cricket::VideoCapturer object that can be | |
| 75 // used when creating a libjingle webrtc::VideoTrackSourceInterface object. | |
| 76 virtual WebRtcVideoCapturerAdapter* CreateVideoCapturer( | |
| 77 bool is_screen_capture); | |
| 78 | |
| 79 // Asks the PeerConnection factory to create a Local VideoTrack object. | 78 // Asks the PeerConnection factory to create a Local VideoTrack object. |
| 80 virtual scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack( | 79 virtual scoped_refptr<webrtc::VideoTrackInterface> CreateLocalVideoTrack( |
| 81 const std::string& id, | 80 const std::string& id, |
| 82 webrtc::VideoTrackSourceInterface* source); | 81 webrtc::VideoTrackSourceInterface* source); |
| 83 | 82 |
| 84 // Asks the PeerConnection factory to create a Video Source. | |
| 85 // The video source takes ownership of |capturer|. | |
| 86 virtual scoped_refptr<webrtc::VideoTrackSourceInterface> CreateVideoSource( | |
| 87 cricket::VideoCapturer* capturer); | |
| 88 | |
| 89 // Asks the libjingle PeerConnection factory to create a libjingle | 83 // Asks the libjingle PeerConnection factory to create a libjingle |
| 90 // PeerConnection object. | 84 // PeerConnection object. |
| 91 // The PeerConnection object is owned by PeerConnectionHandler. | 85 // The PeerConnection object is owned by PeerConnectionHandler. |
| 92 virtual scoped_refptr<webrtc::PeerConnectionInterface> | 86 virtual scoped_refptr<webrtc::PeerConnectionInterface> |
| 93 CreatePeerConnection( | 87 CreatePeerConnection( |
| 94 const webrtc::PeerConnectionInterface::RTCConfiguration& config, | 88 const webrtc::PeerConnectionInterface::RTCConfiguration& config, |
| 95 blink::WebFrame* web_frame, | 89 blink::WebFrame* web_frame, |
| 96 webrtc::PeerConnectionObserver* observer); | 90 webrtc::PeerConnectionObserver* observer); |
| 97 | 91 |
| 98 // Creates a libjingle representation of a Session description. Used by a | 92 // Creates a libjingle representation of a Session description. Used by a |
| (...skipping 10 matching lines...) Expand all Loading... |
| 109 const std::string& sdp); | 103 const std::string& sdp); |
| 110 | 104 |
| 111 WebRtcAudioDeviceImpl* GetWebRtcAudioDevice(); | 105 WebRtcAudioDeviceImpl* GetWebRtcAudioDevice(); |
| 112 | 106 |
| 113 void EnsureInitialized(); | 107 void EnsureInitialized(); |
| 114 scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcWorkerThread() const; | 108 scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcWorkerThread() const; |
| 115 virtual scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcSignalingThread() | 109 virtual scoped_refptr<base::SingleThreadTaskRunner> GetWebRtcSignalingThread() |
| 116 const; | 110 const; |
| 117 | 111 |
| 118 protected: | 112 protected: |
| 119 // Asks the PeerConnection factory to create a Local VideoTrack object with | |
| 120 // the video source using |capturer|. | |
| 121 virtual scoped_refptr<webrtc::VideoTrackInterface> | |
| 122 CreateLocalVideoTrack(const std::string& id, | |
| 123 cricket::VideoCapturer* capturer); | |
| 124 | |
| 125 virtual const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& | 113 virtual const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& |
| 126 GetPcFactory(); | 114 GetPcFactory(); |
| 127 virtual bool PeerConnectionFactoryCreated(); | 115 virtual bool PeerConnectionFactoryCreated(); |
| 128 | 116 |
| 129 // Helper method to create a WebRtcAudioDeviceImpl. | 117 // Helper method to create a WebRtcAudioDeviceImpl. |
| 130 void EnsureWebRtcAudioDeviceImpl(); | 118 void EnsureWebRtcAudioDeviceImpl(); |
| 131 | 119 |
| 132 private: | 120 private: |
| 133 // Implement base::MessageLoop::DestructionObserver. | 121 // Implement base::MessageLoop::DestructionObserver. |
| 134 // This makes sure the libjingle PeerConnectionFactory is released before | 122 // This makes sure the libjingle PeerConnectionFactory is released before |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 rtc::Thread* worker_thread_; | 161 rtc::Thread* worker_thread_; |
| 174 base::Thread chrome_signaling_thread_; | 162 base::Thread chrome_signaling_thread_; |
| 175 base::Thread chrome_worker_thread_; | 163 base::Thread chrome_worker_thread_; |
| 176 | 164 |
| 177 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); | 165 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); |
| 178 }; | 166 }; |
| 179 | 167 |
| 180 } // namespace content | 168 } // namespace content |
| 181 | 169 |
| 182 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 170 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
| OLD | NEW |