OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_PC_CHANNELMANAGER_H_ | 11 #ifndef WEBRTC_PC_CHANNELMANAGER_H_ |
12 #define WEBRTC_PC_CHANNELMANAGER_H_ | 12 #define WEBRTC_PC_CHANNELMANAGER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/base/fileutils.h" | 18 #include "webrtc/base/fileutils.h" |
19 #include "webrtc/base/thread.h" | 19 #include "webrtc/base/thread.h" |
20 #include "webrtc/media/base/mediaengine.h" | 20 #include "webrtc/media/base/mediaengine.h" |
21 #include "webrtc/pc/voicechannel.h" | 21 #include "webrtc/pc/voicechannel.h" |
22 | 22 |
23 namespace webrtc { | |
24 class MediaControllerInterface; | |
25 } | |
26 namespace cricket { | 23 namespace cricket { |
27 | 24 |
28 class VoiceChannel; | 25 class VoiceChannel; |
29 | 26 |
30 // ChannelManager allows the MediaEngine to run on a separate thread, and takes | 27 // ChannelManager allows the MediaEngine to run on a separate thread, and takes |
31 // care of marshalling calls between threads. It also creates and keeps track of | 28 // care of marshalling calls between threads. It also creates and keeps track of |
32 // voice and video channels; by doing so, it can temporarily pause all the | 29 // voice and video channels; by doing so, it can temporarily pause all the |
33 // channels when a new audio or video device is chosen. The voice and video | 30 // channels when a new audio or video device is chosen. The voice and video |
34 // channels are stored in separate vectors, to easily allow operations on just | 31 // channels are stored in separate vectors, to easily allow operations on just |
35 // voice or just video channels. | 32 // voice or just video channels. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Indicates whether the media engine is started. | 78 // Indicates whether the media engine is started. |
82 bool initialized() const { return initialized_; } | 79 bool initialized() const { return initialized_; } |
83 // Starts up the media engine. | 80 // Starts up the media engine. |
84 bool Init(); | 81 bool Init(); |
85 // Shuts down the media engine. | 82 // Shuts down the media engine. |
86 void Terminate(); | 83 void Terminate(); |
87 | 84 |
88 // The operations below all occur on the worker thread. | 85 // The operations below all occur on the worker thread. |
89 // Creates a voice channel, to be associated with the specified session. | 86 // Creates a voice channel, to be associated with the specified session. |
90 VoiceChannel* CreateVoiceChannel( | 87 VoiceChannel* CreateVoiceChannel( |
91 webrtc::MediaControllerInterface* media_controller, | 88 webrtc::Call* call, |
| 89 const cricket::MediaConfig& media_config, |
92 DtlsTransportInternal* rtp_transport, | 90 DtlsTransportInternal* rtp_transport, |
93 DtlsTransportInternal* rtcp_transport, | 91 DtlsTransportInternal* rtcp_transport, |
94 rtc::Thread* signaling_thread, | 92 rtc::Thread* signaling_thread, |
95 const std::string& content_name, | 93 const std::string& content_name, |
96 bool srtp_required, | 94 bool srtp_required, |
97 const AudioOptions& options); | 95 const AudioOptions& options); |
98 // Version of the above that takes PacketTransportInternal. | 96 // Version of the above that takes PacketTransportInternal. |
99 VoiceChannel* CreateVoiceChannel( | 97 VoiceChannel* CreateVoiceChannel( |
100 webrtc::MediaControllerInterface* media_controller, | 98 webrtc::Call* call, |
| 99 const cricket::MediaConfig& media_config, |
101 rtc::PacketTransportInternal* rtp_transport, | 100 rtc::PacketTransportInternal* rtp_transport, |
102 rtc::PacketTransportInternal* rtcp_transport, | 101 rtc::PacketTransportInternal* rtcp_transport, |
103 rtc::Thread* signaling_thread, | 102 rtc::Thread* signaling_thread, |
104 const std::string& content_name, | 103 const std::string& content_name, |
105 bool srtp_required, | 104 bool srtp_required, |
106 const AudioOptions& options); | 105 const AudioOptions& options); |
107 // Destroys a voice channel created with the Create API. | 106 // Destroys a voice channel created with the Create API. |
108 void DestroyVoiceChannel(VoiceChannel* voice_channel); | 107 void DestroyVoiceChannel(VoiceChannel* voice_channel); |
109 // Creates a video channel, synced with the specified voice channel, and | 108 // Creates a video channel, synced with the specified voice channel, and |
110 // associated with the specified session. | 109 // associated with the specified session. |
111 VideoChannel* CreateVideoChannel( | 110 VideoChannel* CreateVideoChannel( |
112 webrtc::MediaControllerInterface* media_controller, | 111 webrtc::Call* call, |
| 112 const cricket::MediaConfig& media_config, |
113 DtlsTransportInternal* rtp_transport, | 113 DtlsTransportInternal* rtp_transport, |
114 DtlsTransportInternal* rtcp_transport, | 114 DtlsTransportInternal* rtcp_transport, |
115 rtc::Thread* signaling_thread, | 115 rtc::Thread* signaling_thread, |
116 const std::string& content_name, | 116 const std::string& content_name, |
117 bool srtp_required, | 117 bool srtp_required, |
118 const VideoOptions& options); | 118 const VideoOptions& options); |
119 // Version of the above that takes PacketTransportInternal. | 119 // Version of the above that takes PacketTransportInternal. |
120 VideoChannel* CreateVideoChannel( | 120 VideoChannel* CreateVideoChannel( |
121 webrtc::MediaControllerInterface* media_controller, | 121 webrtc::Call* call, |
| 122 const cricket::MediaConfig& media_config, |
122 rtc::PacketTransportInternal* rtp_transport, | 123 rtc::PacketTransportInternal* rtp_transport, |
123 rtc::PacketTransportInternal* rtcp_transport, | 124 rtc::PacketTransportInternal* rtcp_transport, |
124 rtc::Thread* signaling_thread, | 125 rtc::Thread* signaling_thread, |
125 const std::string& content_name, | 126 const std::string& content_name, |
126 bool srtp_required, | 127 bool srtp_required, |
127 const VideoOptions& options); | 128 const VideoOptions& options); |
128 // Destroys a video channel created with the Create API. | 129 // Destroys a video channel created with the Create API. |
129 void DestroyVideoChannel(VideoChannel* video_channel); | 130 void DestroyVideoChannel(VideoChannel* video_channel); |
130 RtpDataChannel* CreateRtpDataChannel( | 131 RtpDataChannel* CreateRtpDataChannel( |
131 webrtc::MediaControllerInterface* media_controller, | 132 const cricket::MediaConfig& media_config, |
132 DtlsTransportInternal* rtp_transport, | 133 DtlsTransportInternal* rtp_transport, |
133 DtlsTransportInternal* rtcp_transport, | 134 DtlsTransportInternal* rtcp_transport, |
134 rtc::Thread* signaling_thread, | 135 rtc::Thread* signaling_thread, |
135 const std::string& content_name, | 136 const std::string& content_name, |
136 bool srtp_required); | 137 bool srtp_required); |
137 // Destroys a data channel created with the Create API. | 138 // Destroys a data channel created with the Create API. |
138 void DestroyRtpDataChannel(RtpDataChannel* data_channel); | 139 void DestroyRtpDataChannel(RtpDataChannel* data_channel); |
139 | 140 |
140 // Indicates whether any channels exist. | 141 // Indicates whether any channels exist. |
141 bool has_channels() const { | 142 bool has_channels() const { |
(...skipping 23 matching lines...) Expand all Loading... |
165 typedef std::vector<RtpDataChannel*> RtpDataChannels; | 166 typedef std::vector<RtpDataChannel*> RtpDataChannels; |
166 | 167 |
167 void Construct(std::unique_ptr<MediaEngineInterface> me, | 168 void Construct(std::unique_ptr<MediaEngineInterface> me, |
168 std::unique_ptr<DataEngineInterface> dme, | 169 std::unique_ptr<DataEngineInterface> dme, |
169 rtc::Thread* worker_thread, | 170 rtc::Thread* worker_thread, |
170 rtc::Thread* network_thread); | 171 rtc::Thread* network_thread); |
171 bool InitMediaEngine_w(); | 172 bool InitMediaEngine_w(); |
172 void DestructorDeletes_w(); | 173 void DestructorDeletes_w(); |
173 void Terminate_w(); | 174 void Terminate_w(); |
174 VoiceChannel* CreateVoiceChannel_w( | 175 VoiceChannel* CreateVoiceChannel_w( |
175 webrtc::MediaControllerInterface* media_controller, | 176 webrtc::Call* call, |
| 177 const cricket::MediaConfig& media_config, |
176 DtlsTransportInternal* rtp_dtls_transport, | 178 DtlsTransportInternal* rtp_dtls_transport, |
177 DtlsTransportInternal* rtcp_dtls_transport, | 179 DtlsTransportInternal* rtcp_dtls_transport, |
178 rtc::PacketTransportInternal* rtp_packet_transport, | 180 rtc::PacketTransportInternal* rtp_packet_transport, |
179 rtc::PacketTransportInternal* rtcp_packet_transport, | 181 rtc::PacketTransportInternal* rtcp_packet_transport, |
180 rtc::Thread* signaling_thread, | 182 rtc::Thread* signaling_thread, |
181 const std::string& content_name, | 183 const std::string& content_name, |
182 bool srtp_required, | 184 bool srtp_required, |
183 const AudioOptions& options); | 185 const AudioOptions& options); |
184 void DestroyVoiceChannel_w(VoiceChannel* voice_channel); | 186 void DestroyVoiceChannel_w(VoiceChannel* voice_channel); |
185 VideoChannel* CreateVideoChannel_w( | 187 VideoChannel* CreateVideoChannel_w( |
186 webrtc::MediaControllerInterface* media_controller, | 188 webrtc::Call* call, |
| 189 const cricket::MediaConfig& media_config, |
187 DtlsTransportInternal* rtp_dtls_transport, | 190 DtlsTransportInternal* rtp_dtls_transport, |
188 DtlsTransportInternal* rtcp_dtls_transport, | 191 DtlsTransportInternal* rtcp_dtls_transport, |
189 rtc::PacketTransportInternal* rtp_packet_transport, | 192 rtc::PacketTransportInternal* rtp_packet_transport, |
190 rtc::PacketTransportInternal* rtcp_packet_transport, | 193 rtc::PacketTransportInternal* rtcp_packet_transport, |
191 rtc::Thread* signaling_thread, | 194 rtc::Thread* signaling_thread, |
192 const std::string& content_name, | 195 const std::string& content_name, |
193 bool srtp_required, | 196 bool srtp_required, |
194 const VideoOptions& options); | 197 const VideoOptions& options); |
195 void DestroyVideoChannel_w(VideoChannel* video_channel); | 198 void DestroyVideoChannel_w(VideoChannel* video_channel); |
196 RtpDataChannel* CreateRtpDataChannel_w( | 199 RtpDataChannel* CreateRtpDataChannel_w( |
197 webrtc::MediaControllerInterface* media_controller, | 200 const cricket::MediaConfig& media_config, |
198 DtlsTransportInternal* rtp_transport, | 201 DtlsTransportInternal* rtp_transport, |
199 DtlsTransportInternal* rtcp_transport, | 202 DtlsTransportInternal* rtcp_transport, |
200 rtc::Thread* signaling_thread, | 203 rtc::Thread* signaling_thread, |
201 const std::string& content_name, | 204 const std::string& content_name, |
202 bool srtp_required); | 205 bool srtp_required); |
203 void DestroyRtpDataChannel_w(RtpDataChannel* data_channel); | 206 void DestroyRtpDataChannel_w(RtpDataChannel* data_channel); |
204 | 207 |
205 std::unique_ptr<MediaEngineInterface> media_engine_; | 208 std::unique_ptr<MediaEngineInterface> media_engine_; |
206 std::unique_ptr<DataEngineInterface> data_media_engine_; | 209 std::unique_ptr<DataEngineInterface> data_media_engine_; |
207 bool initialized_; | 210 bool initialized_; |
208 rtc::Thread* main_thread_; | 211 rtc::Thread* main_thread_; |
209 rtc::Thread* worker_thread_; | 212 rtc::Thread* worker_thread_; |
210 rtc::Thread* network_thread_; | 213 rtc::Thread* network_thread_; |
211 | 214 |
212 VoiceChannels voice_channels_; | 215 VoiceChannels voice_channels_; |
213 VideoChannels video_channels_; | 216 VideoChannels video_channels_; |
214 RtpDataChannels data_channels_; | 217 RtpDataChannels data_channels_; |
215 | 218 |
216 bool enable_rtx_; | 219 bool enable_rtx_; |
217 rtc::CryptoOptions crypto_options_; | 220 rtc::CryptoOptions crypto_options_; |
218 | 221 |
219 bool capturing_; | 222 bool capturing_; |
220 }; | 223 }; |
221 | 224 |
222 } // namespace cricket | 225 } // namespace cricket |
223 | 226 |
224 #endif // WEBRTC_PC_CHANNELMANAGER_H_ | 227 #endif // WEBRTC_PC_CHANNELMANAGER_H_ |
OLD | NEW |