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" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/renderer/media/webrtc/stun_field_trial.h" | 16 #include "content/renderer/media/webrtc/stun_field_trial.h" |
17 #include "content/renderer/p2p/socket_dispatcher.h" | 17 #include "content/renderer/p2p/socket_dispatcher.h" |
18 #include "ipc/ipc_platform_file.h" | 18 #include "ipc/ipc_platform_file.h" |
19 #include "third_party/webrtc/api/peerconnectioninterface.h" | 19 #include "third_party/webrtc/api/peerconnectioninterface.h" |
20 #include "third_party/webrtc/p2p/stunprober/stunprober.h" | 20 #include "third_party/webrtc/p2p/stunprober/stunprober.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class WaitableEvent; | 23 class WaitableEvent; |
24 } | 24 } |
25 | 25 |
26 namespace media { | 26 namespace media { |
27 class GpuVideoAcceleratorFactories; | 27 class GpuVideoAcceleratorFactories; |
| 28 class VideoDecoder; |
28 } | 29 } |
29 | 30 |
30 namespace rtc { | 31 namespace rtc { |
31 class NetworkManager; | 32 class NetworkManager; |
32 class PacketSocketFactory; | 33 class PacketSocketFactory; |
33 class Thread; | 34 class Thread; |
34 } | 35 } |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 class WebFrame; | 38 class WebFrame; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 126 |
126 // Functions related to Stun probing trial to determine how fast we could send | 127 // Functions related to Stun probing trial to determine how fast we could send |
127 // Stun request without being dropped by NAT. | 128 // Stun request without being dropped by NAT. |
128 void TryScheduleStunProbeTrial(); | 129 void TryScheduleStunProbeTrial(); |
129 void StartStunProbeTrialOnWorkerThread(const std::string& params); | 130 void StartStunProbeTrialOnWorkerThread(const std::string& params); |
130 | 131 |
131 // Creates |pc_factory_|, which in turn is used for | 132 // Creates |pc_factory_|, which in turn is used for |
132 // creating PeerConnection objects. | 133 // creating PeerConnection objects. |
133 void CreatePeerConnectionFactory(); | 134 void CreatePeerConnectionFactory(); |
134 | 135 |
| 136 using CreateVideoDecoderCB = |
| 137 base::Callback<std::unique_ptr<media::VideoDecoder>()>; |
| 138 |
135 void InitializeSignalingThread( | 139 void InitializeSignalingThread( |
136 media::GpuVideoAcceleratorFactories* gpu_factories, | 140 media::GpuVideoAcceleratorFactories* gpu_factories, |
| 141 const CreateVideoDecoderCB& create_video_decoder_cb, |
| 142 const scoped_refptr<base::SingleThreadTaskRunner>& decoder_task_runner, |
137 base::WaitableEvent* event); | 143 base::WaitableEvent* event); |
138 | 144 |
139 void InitializeWorkerThread(rtc::Thread** thread, | 145 void InitializeWorkerThread(rtc::Thread** thread, |
140 base::WaitableEvent* event); | 146 base::WaitableEvent* event); |
141 | 147 |
142 void CreateIpcNetworkManagerOnWorkerThread(base::WaitableEvent* event); | 148 void CreateIpcNetworkManagerOnWorkerThread(base::WaitableEvent* event); |
143 void DeleteIpcNetworkManager(); | 149 void DeleteIpcNetworkManager(); |
144 void CleanupPeerConnectionFactory(); | 150 void CleanupPeerConnectionFactory(); |
145 | 151 |
146 // We own network_manager_, must be deleted on the worker thread. | 152 // We own network_manager_, must be deleted on the worker thread. |
147 // The network manager uses |p2p_socket_dispatcher_|. | 153 // The network manager uses |p2p_socket_dispatcher_|. |
148 IpcNetworkManager* network_manager_; | 154 IpcNetworkManager* network_manager_; |
149 std::unique_ptr<IpcPacketSocketFactory> socket_factory_; | 155 std::unique_ptr<IpcPacketSocketFactory> socket_factory_; |
150 | 156 |
151 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; | 157 scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_; |
152 | 158 |
153 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; | 159 scoped_refptr<P2PSocketDispatcher> p2p_socket_dispatcher_; |
154 scoped_refptr<WebRtcAudioDeviceImpl> audio_device_; | 160 scoped_refptr<WebRtcAudioDeviceImpl> audio_device_; |
155 | 161 |
156 std::unique_ptr<StunProberTrial> stun_trial_; | 162 std::unique_ptr<StunProberTrial> stun_trial_; |
157 | 163 |
158 // PeerConnection threads. signaling_thread_ is created from the | 164 // PeerConnection threads. signaling_thread_ is created from the |
159 // "current" chrome thread. | 165 // "current" chrome thread. |
160 rtc::Thread* signaling_thread_; | 166 rtc::Thread* signaling_thread_; |
161 rtc::Thread* worker_thread_; | 167 rtc::Thread* worker_thread_; |
162 base::Thread chrome_signaling_thread_; | 168 base::Thread chrome_signaling_thread_; |
163 base::Thread chrome_worker_thread_; | 169 base::Thread chrome_worker_thread_; |
164 | 170 |
| 171 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 172 |
165 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); | 173 DISALLOW_COPY_AND_ASSIGN(PeerConnectionDependencyFactory); |
166 }; | 174 }; |
167 | 175 |
168 } // namespace content | 176 } // namespace content |
169 | 177 |
170 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ | 178 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_PEER_CONNECTION_DEPENDENCY_FACTORY_H_ |
OLD | NEW |