| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // voice and video channels; by doing so, it can temporarily pause all the | 32 // 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 | 33 // 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 | 34 // channels are stored in separate vectors, to easily allow operations on just |
| 35 // voice or just video channels. | 35 // voice or just video channels. |
| 36 // ChannelManager also allows the application to discover what devices it has | 36 // ChannelManager also allows the application to discover what devices it has |
| 37 // using device manager. | 37 // using device manager. |
| 38 class ChannelManager { | 38 class ChannelManager { |
| 39 public: | 39 public: |
| 40 // For testing purposes. Allows the media engine and data media | 40 // For testing purposes. Allows the media engine and data media |
| 41 // engine and dev manager to be mocks. The ChannelManager takes | 41 // engine and dev manager to be mocks. The ChannelManager takes |
| 42 // ownership of these objects. | 42 // ownership of the objects passed as unique_ptrs. |
| 43 ChannelManager(MediaEngineInterface* me, | 43 ChannelManager(std::unique_ptr<MediaEngineInterface> me, |
| 44 DataEngineInterface* dme, | 44 std::unique_ptr<DataEngineInterface> dme, |
| 45 rtc::Thread* worker_and_network); | 45 rtc::Thread* worker_and_network); |
| 46 // Same as above, but gives an easier default DataEngine. | 46 // Same as above, but gives an easier default DataEngine. |
| 47 ChannelManager(MediaEngineInterface* me, | 47 ChannelManager(std::unique_ptr<MediaEngineInterface> me, |
| 48 rtc::Thread* worker, | 48 rtc::Thread* worker, |
| 49 rtc::Thread* network); | 49 rtc::Thread* network); |
| 50 ~ChannelManager(); | 50 ~ChannelManager(); |
| 51 | 51 |
| 52 // Accessors for the worker thread, allowing it to be set after construction, | 52 // Accessors for the worker thread, allowing it to be set after construction, |
| 53 // but before Init. set_worker_thread will return false if called after Init. | 53 // but before Init. set_worker_thread will return false if called after Init. |
| 54 rtc::Thread* worker_thread() const { return worker_thread_; } | 54 rtc::Thread* worker_thread() const { return worker_thread_; } |
| 55 bool set_worker_thread(rtc::Thread* thread) { | 55 bool set_worker_thread(rtc::Thread* thread) { |
| 56 if (initialized_) { | 56 if (initialized_) { |
| 57 return false; | 57 return false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 87 void Terminate(); | 87 void Terminate(); |
| 88 | 88 |
| 89 // The operations below all occur on the worker thread. | 89 // The operations below all occur on the worker thread. |
| 90 // Creates a voice channel, to be associated with the specified session. | 90 // Creates a voice channel, to be associated with the specified session. |
| 91 VoiceChannel* CreateVoiceChannel( | 91 VoiceChannel* CreateVoiceChannel( |
| 92 webrtc::MediaControllerInterface* media_controller, | 92 webrtc::MediaControllerInterface* media_controller, |
| 93 DtlsTransportInternal* rtp_transport, | 93 DtlsTransportInternal* rtp_transport, |
| 94 DtlsTransportInternal* rtcp_transport, | 94 DtlsTransportInternal* rtcp_transport, |
| 95 rtc::Thread* signaling_thread, | 95 rtc::Thread* signaling_thread, |
| 96 const std::string& content_name, | 96 const std::string& content_name, |
| 97 const std::string* bundle_transport_name, | 97 bool srtp_required, |
| 98 bool rtcp_mux_required, | 98 const AudioOptions& options); |
| 99 // Version of the above that takes PacketTransportInternal. |
| 100 VoiceChannel* CreateVoiceChannel( |
| 101 webrtc::MediaControllerInterface* media_controller, |
| 102 rtc::PacketTransportInternal* rtp_transport, |
| 103 rtc::PacketTransportInternal* rtcp_transport, |
| 104 rtc::Thread* signaling_thread, |
| 105 const std::string& content_name, |
| 99 bool srtp_required, | 106 bool srtp_required, |
| 100 const AudioOptions& options); | 107 const AudioOptions& options); |
| 101 // Destroys a voice channel created with the Create API. | 108 // Destroys a voice channel created with the Create API. |
| 102 void DestroyVoiceChannel(VoiceChannel* voice_channel); | 109 void DestroyVoiceChannel(VoiceChannel* voice_channel); |
| 103 // Creates a video channel, synced with the specified voice channel, and | 110 // Creates a video channel, synced with the specified voice channel, and |
| 104 // associated with the specified session. | 111 // associated with the specified session. |
| 105 VideoChannel* CreateVideoChannel( | 112 VideoChannel* CreateVideoChannel( |
| 106 webrtc::MediaControllerInterface* media_controller, | 113 webrtc::MediaControllerInterface* media_controller, |
| 107 DtlsTransportInternal* rtp_transport, | 114 DtlsTransportInternal* rtp_transport, |
| 108 DtlsTransportInternal* rtcp_transport, | 115 DtlsTransportInternal* rtcp_transport, |
| 109 rtc::Thread* signaling_thread, | 116 rtc::Thread* signaling_thread, |
| 110 const std::string& content_name, | 117 const std::string& content_name, |
| 111 const std::string* bundle_transport_name, | 118 bool srtp_required, |
| 112 bool rtcp_mux_required, | 119 const VideoOptions& options); |
| 120 // Version of the above that takes PacketTransportInternal. |
| 121 VideoChannel* CreateVideoChannel( |
| 122 webrtc::MediaControllerInterface* media_controller, |
| 123 rtc::PacketTransportInternal* rtp_transport, |
| 124 rtc::PacketTransportInternal* rtcp_transport, |
| 125 rtc::Thread* signaling_thread, |
| 126 const std::string& content_name, |
| 113 bool srtp_required, | 127 bool srtp_required, |
| 114 const VideoOptions& options); | 128 const VideoOptions& options); |
| 115 // Destroys a video channel created with the Create API. | 129 // Destroys a video channel created with the Create API. |
| 116 void DestroyVideoChannel(VideoChannel* video_channel); | 130 void DestroyVideoChannel(VideoChannel* video_channel); |
| 117 RtpDataChannel* CreateRtpDataChannel( | 131 RtpDataChannel* CreateRtpDataChannel( |
| 118 webrtc::MediaControllerInterface* media_controller, | 132 webrtc::MediaControllerInterface* media_controller, |
| 119 DtlsTransportInternal* rtp_transport, | 133 DtlsTransportInternal* rtp_transport, |
| 120 DtlsTransportInternal* rtcp_transport, | 134 DtlsTransportInternal* rtcp_transport, |
| 121 rtc::Thread* signaling_thread, | 135 rtc::Thread* signaling_thread, |
| 122 const std::string& content_name, | 136 const std::string& content_name, |
| 123 const std::string* bundle_transport_name, | |
| 124 bool rtcp_mux_required, | |
| 125 bool srtp_required); | 137 bool srtp_required); |
| 126 // Destroys a data channel created with the Create API. | 138 // Destroys a data channel created with the Create API. |
| 127 void DestroyRtpDataChannel(RtpDataChannel* data_channel); | 139 void DestroyRtpDataChannel(RtpDataChannel* data_channel); |
| 128 | 140 |
| 129 // Indicates whether any channels exist. | 141 // Indicates whether any channels exist. |
| 130 bool has_channels() const { | 142 bool has_channels() const { |
| 131 return (!voice_channels_.empty() || !video_channels_.empty()); | 143 return (!voice_channels_.empty() || !video_channels_.empty()); |
| 132 } | 144 } |
| 133 | 145 |
| 134 // RTX will be enabled/disabled in engines that support it. The supporting | 146 // RTX will be enabled/disabled in engines that support it. The supporting |
| (...skipping 15 matching lines...) Expand all Loading... |
| 150 bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes); | 162 bool StartAecDump(rtc::PlatformFile file, int64_t max_size_bytes); |
| 151 | 163 |
| 152 // Stops recording AEC dump. | 164 // Stops recording AEC dump. |
| 153 void StopAecDump(); | 165 void StopAecDump(); |
| 154 | 166 |
| 155 private: | 167 private: |
| 156 typedef std::vector<VoiceChannel*> VoiceChannels; | 168 typedef std::vector<VoiceChannel*> VoiceChannels; |
| 157 typedef std::vector<VideoChannel*> VideoChannels; | 169 typedef std::vector<VideoChannel*> VideoChannels; |
| 158 typedef std::vector<RtpDataChannel*> RtpDataChannels; | 170 typedef std::vector<RtpDataChannel*> RtpDataChannels; |
| 159 | 171 |
| 160 void Construct(MediaEngineInterface* me, | 172 void Construct(std::unique_ptr<MediaEngineInterface> me, |
| 161 DataEngineInterface* dme, | 173 std::unique_ptr<DataEngineInterface> dme, |
| 162 rtc::Thread* worker_thread, | 174 rtc::Thread* worker_thread, |
| 163 rtc::Thread* network_thread); | 175 rtc::Thread* network_thread); |
| 164 bool InitMediaEngine_w(); | 176 bool InitMediaEngine_w(); |
| 165 void DestructorDeletes_w(); | 177 void DestructorDeletes_w(); |
| 166 void Terminate_w(); | 178 void Terminate_w(); |
| 167 bool SetCryptoOptions_w(const rtc::CryptoOptions& crypto_options); | 179 bool SetCryptoOptions_w(const rtc::CryptoOptions& crypto_options); |
| 168 VoiceChannel* CreateVoiceChannel_w( | 180 VoiceChannel* CreateVoiceChannel_w( |
| 169 webrtc::MediaControllerInterface* media_controller, | 181 webrtc::MediaControllerInterface* media_controller, |
| 170 DtlsTransportInternal* rtp_transport, | 182 DtlsTransportInternal* rtp_dtls_transport, |
| 171 DtlsTransportInternal* rtcp_transport, | 183 DtlsTransportInternal* rtcp_dtls_transport, |
| 184 rtc::PacketTransportInternal* rtp_packet_transport, |
| 185 rtc::PacketTransportInternal* rtcp_packet_transport, |
| 172 rtc::Thread* signaling_thread, | 186 rtc::Thread* signaling_thread, |
| 173 const std::string& content_name, | 187 const std::string& content_name, |
| 174 const std::string* bundle_transport_name, | |
| 175 bool rtcp_mux_required, | |
| 176 bool srtp_required, | 188 bool srtp_required, |
| 177 const AudioOptions& options); | 189 const AudioOptions& options); |
| 178 void DestroyVoiceChannel_w(VoiceChannel* voice_channel); | 190 void DestroyVoiceChannel_w(VoiceChannel* voice_channel); |
| 179 VideoChannel* CreateVideoChannel_w( | 191 VideoChannel* CreateVideoChannel_w( |
| 180 webrtc::MediaControllerInterface* media_controller, | 192 webrtc::MediaControllerInterface* media_controller, |
| 181 DtlsTransportInternal* rtp_transport, | 193 DtlsTransportInternal* rtp_dtls_transport, |
| 182 DtlsTransportInternal* rtcp_transport, | 194 DtlsTransportInternal* rtcp_dtls_transport, |
| 195 rtc::PacketTransportInternal* rtp_packet_transport, |
| 196 rtc::PacketTransportInternal* rtcp_packet_transport, |
| 183 rtc::Thread* signaling_thread, | 197 rtc::Thread* signaling_thread, |
| 184 const std::string& content_name, | 198 const std::string& content_name, |
| 185 const std::string* bundle_transport_name, | |
| 186 bool rtcp_mux_required, | |
| 187 bool srtp_required, | 199 bool srtp_required, |
| 188 const VideoOptions& options); | 200 const VideoOptions& options); |
| 189 void DestroyVideoChannel_w(VideoChannel* video_channel); | 201 void DestroyVideoChannel_w(VideoChannel* video_channel); |
| 190 RtpDataChannel* CreateRtpDataChannel_w( | 202 RtpDataChannel* CreateRtpDataChannel_w( |
| 191 webrtc::MediaControllerInterface* media_controller, | 203 webrtc::MediaControllerInterface* media_controller, |
| 192 DtlsTransportInternal* rtp_transport, | 204 DtlsTransportInternal* rtp_transport, |
| 193 DtlsTransportInternal* rtcp_transport, | 205 DtlsTransportInternal* rtcp_transport, |
| 194 rtc::Thread* signaling_thread, | 206 rtc::Thread* signaling_thread, |
| 195 const std::string& content_name, | 207 const std::string& content_name, |
| 196 const std::string* bundle_transport_name, | |
| 197 bool rtcp_mux_required, | |
| 198 bool srtp_required); | 208 bool srtp_required); |
| 199 void DestroyRtpDataChannel_w(RtpDataChannel* data_channel); | 209 void DestroyRtpDataChannel_w(RtpDataChannel* data_channel); |
| 200 | 210 |
| 201 std::unique_ptr<MediaEngineInterface> media_engine_; | 211 std::unique_ptr<MediaEngineInterface> media_engine_; |
| 202 std::unique_ptr<DataEngineInterface> data_media_engine_; | 212 std::unique_ptr<DataEngineInterface> data_media_engine_; |
| 203 bool initialized_; | 213 bool initialized_; |
| 204 rtc::Thread* main_thread_; | 214 rtc::Thread* main_thread_; |
| 205 rtc::Thread* worker_thread_; | 215 rtc::Thread* worker_thread_; |
| 206 rtc::Thread* network_thread_; | 216 rtc::Thread* network_thread_; |
| 207 | 217 |
| 208 VoiceChannels voice_channels_; | 218 VoiceChannels voice_channels_; |
| 209 VideoChannels video_channels_; | 219 VideoChannels video_channels_; |
| 210 RtpDataChannels data_channels_; | 220 RtpDataChannels data_channels_; |
| 211 | 221 |
| 212 bool enable_rtx_; | 222 bool enable_rtx_; |
| 213 rtc::CryptoOptions crypto_options_; | 223 rtc::CryptoOptions crypto_options_; |
| 214 | 224 |
| 215 bool capturing_; | 225 bool capturing_; |
| 216 }; | 226 }; |
| 217 | 227 |
| 218 } // namespace cricket | 228 } // namespace cricket |
| 219 | 229 |
| 220 #endif // WEBRTC_PC_CHANNELMANAGER_H_ | 230 #endif // WEBRTC_PC_CHANNELMANAGER_H_ |
| OLD | NEW |