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/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 webrtc::SdpParseError* error); | 116 webrtc::SdpParseError* error); |
117 | 117 |
118 // Creates a libjingle representation of an ice candidate. | 118 // Creates a libjingle representation of an ice candidate. |
119 virtual webrtc::IceCandidateInterface* CreateIceCandidate( | 119 virtual webrtc::IceCandidateInterface* CreateIceCandidate( |
120 const std::string& sdp_mid, | 120 const std::string& sdp_mid, |
121 int sdp_mline_index, | 121 int sdp_mline_index, |
122 const std::string& sdp); | 122 const std::string& sdp); |
123 | 123 |
124 WebRtcAudioDeviceImpl* GetWebRtcAudioDevice(); | 124 WebRtcAudioDeviceImpl* GetWebRtcAudioDevice(); |
125 | 125 |
126 static void AddNativeAudioTrackToBlinkTrack( | |
127 webrtc::MediaStreamTrackInterface* native_track, | |
128 const blink::WebMediaStreamTrack& webkit_track, | |
129 bool is_local_track); | |
130 | |
131 scoped_refptr<base::MessageLoopProxy> GetWebRtcWorkerThread() const; | 126 scoped_refptr<base::MessageLoopProxy> GetWebRtcWorkerThread() const; |
132 scoped_refptr<base::MessageLoopProxy> GetWebRtcSignalingThread() const; | 127 scoped_refptr<base::MessageLoopProxy> GetWebRtcSignalingThread() const; |
133 | 128 |
134 // AecDumpMessageFilter::AecDumpDelegate implementation. | 129 // AecDumpMessageFilter::AecDumpDelegate implementation. |
135 // TODO(xians): Remove when option to disable audio track processing is | 130 // TODO(xians): Remove when option to disable audio track processing is |
136 // removed. | 131 // removed. |
137 void OnAecDumpFile(const IPC::PlatformFileForTransit& file_handle) override; | 132 void OnAecDumpFile(const IPC::PlatformFileForTransit& file_handle) override; |
138 void OnDisableAecDump() override; | 133 void OnDisableAecDump() override; |
139 void OnIpcClosing() override; | 134 void OnIpcClosing() override; |
140 | 135 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Adds the audio device as a sink to the audio track and starts the local | 167 // Adds the audio device as a sink to the audio track and starts the local |
173 // audio track. This is virtual for test purposes since no real audio device | 168 // audio track. This is virtual for test purposes since no real audio device |
174 // exist in unit tests. | 169 // exist in unit tests. |
175 virtual void StartLocalAudioTrack(WebRtcLocalAudioTrack* audio_track); | 170 virtual void StartLocalAudioTrack(WebRtcLocalAudioTrack* audio_track); |
176 | 171 |
177 private: | 172 private: |
178 // Creates |pc_factory_|, which in turn is used for | 173 // Creates |pc_factory_|, which in turn is used for |
179 // creating PeerConnection objects. | 174 // creating PeerConnection objects. |
180 void CreatePeerConnectionFactory(); | 175 void CreatePeerConnectionFactory(); |
181 | 176 |
| 177 void InitializeSignalingThread( |
| 178 const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories, |
| 179 base::WaitableEvent* event); |
| 180 |
182 void InitializeWorkerThread(rtc::Thread** thread, | 181 void InitializeWorkerThread(rtc::Thread** thread, |
183 base::WaitableEvent* event); | 182 base::WaitableEvent* event); |
184 | 183 |
185 void CreateIpcNetworkManagerOnWorkerThread(base::WaitableEvent* event); | 184 void CreateIpcNetworkManagerOnWorkerThread(base::WaitableEvent* event); |
186 void DeleteIpcNetworkManager(); | 185 void DeleteIpcNetworkManager(); |
187 void CleanupPeerConnectionFactory(); | 186 void CleanupPeerConnectionFactory(); |
188 | 187 |
189 // Helper method to create a WebRtcAudioDeviceImpl. | 188 // Helper method to create a WebRtcAudioDeviceImpl. |
190 void EnsureWebRtcAudioDeviceImpl(); | 189 void EnsureWebRtcAudioDeviceImpl(); |
191 | 190 |
192 // We own network_manager_, must be deleted on the worker thread. | 191 // We own network_manager_, must be deleted on the worker thread. |
193 // The network manager uses |p2p_socket_dispatcher_|. | 192 // The network manager uses |p2p_socket_dispatcher_|. |
194 IpcNetworkManager* network_manager_; | 193 IpcNetworkManager* network_manager_; |
195 scoped_ptr<IpcPacketSocketFactory> socket_factory_; | 194 scoped_ptr<IpcPacketSocketFactory> socket_factory_; |
196 | 195 |
197 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; | 196 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; |
198 | 197 |
199 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; | 198 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; |
200 scoped_refptr<WebRtcAudioDeviceImpl> audio_device_; | 199 scoped_refptr<WebRtcAudioDeviceImpl> audio_device_; |
201 | 200 |
202 // This is only used if audio track processing is disabled. | 201 // This is only used if audio track processing is disabled. |
203 // TODO(xians): Remove when option to disable audio track processing is | 202 // TODO(xians): Remove when option to disable audio track processing is |
204 // removed. | 203 // removed. |
205 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; | 204 scoped_refptr<AecDumpMessageFilter> aec_dump_message_filter_; |
206 | 205 |
207 // PeerConnection threads. signaling_thread_ is created from the | 206 // PeerConnection threads. signaling_thread_ is created from the |
208 // "current" chrome thread. | 207 // "current" chrome thread. |
209 rtc::Thread* signaling_thread_; | 208 rtc::Thread* signaling_thread_; |
210 rtc::Thread* worker_thread_; | 209 rtc::Thread* worker_thread_; |
| 210 base::Thread chrome_signaling_thread_; |
211 base::Thread chrome_worker_thread_; | 211 base::Thread chrome_worker_thread_; |
212 | 212 |
213 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); | 213 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); |
214 }; | 214 }; |
215 | 215 |
216 } // namespace content | 216 } // namespace content |
217 | 217 |
218 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 218 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
OLD | NEW |