OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Monitoring | 141 // Monitoring |
142 void StartConnectionMonitor(int cms); | 142 void StartConnectionMonitor(int cms); |
143 void StopConnectionMonitor(); | 143 void StopConnectionMonitor(); |
144 // For ConnectionStatsGetter, used by ConnectionMonitor | 144 // For ConnectionStatsGetter, used by ConnectionMonitor |
145 virtual bool GetConnectionStats(ConnectionInfos* infos) override; | 145 virtual bool GetConnectionStats(ConnectionInfos* infos) override; |
146 | 146 |
147 void set_srtp_signal_silent_time(uint32 silent_time) { | 147 void set_srtp_signal_silent_time(uint32 silent_time) { |
148 srtp_filter_.set_signal_silent_time(silent_time); | 148 srtp_filter_.set_signal_silent_time(silent_time); |
149 } | 149 } |
150 | 150 |
151 template <class T> | |
152 void RegisterSendSink(T* sink, | |
153 void (T::*OnPacket)(const void*, size_t, bool), | |
154 SinkType type) { | |
155 rtc::CritScope cs(&signal_send_packet_cs_); | |
156 if (SINK_POST_CRYPTO == type) { | |
157 SignalSendPacketPostCrypto.disconnect(sink); | |
158 SignalSendPacketPostCrypto.connect(sink, OnPacket); | |
159 } else { | |
160 SignalSendPacketPreCrypto.disconnect(sink); | |
161 SignalSendPacketPreCrypto.connect(sink, OnPacket); | |
162 } | |
163 } | |
164 | |
165 void UnregisterSendSink(sigslot::has_slots<>* sink, | |
166 SinkType type) { | |
167 rtc::CritScope cs(&signal_send_packet_cs_); | |
168 if (SINK_POST_CRYPTO == type) { | |
169 SignalSendPacketPostCrypto.disconnect(sink); | |
170 } else { | |
171 SignalSendPacketPreCrypto.disconnect(sink); | |
172 } | |
173 } | |
174 | |
175 bool HasSendSinks(SinkType type) { | |
176 rtc::CritScope cs(&signal_send_packet_cs_); | |
177 if (SINK_POST_CRYPTO == type) { | |
178 return !SignalSendPacketPostCrypto.is_empty(); | |
179 } else { | |
180 return !SignalSendPacketPreCrypto.is_empty(); | |
181 } | |
182 } | |
183 | |
184 template <class T> | |
185 void RegisterRecvSink(T* sink, | |
186 void (T::*OnPacket)(const void*, size_t, bool), | |
187 SinkType type) { | |
188 rtc::CritScope cs(&signal_recv_packet_cs_); | |
189 if (SINK_POST_CRYPTO == type) { | |
190 SignalRecvPacketPostCrypto.disconnect(sink); | |
191 SignalRecvPacketPostCrypto.connect(sink, OnPacket); | |
192 } else { | |
193 SignalRecvPacketPreCrypto.disconnect(sink); | |
194 SignalRecvPacketPreCrypto.connect(sink, OnPacket); | |
195 } | |
196 } | |
197 | |
198 void UnregisterRecvSink(sigslot::has_slots<>* sink, | |
199 SinkType type) { | |
200 rtc::CritScope cs(&signal_recv_packet_cs_); | |
201 if (SINK_POST_CRYPTO == type) { | |
202 SignalRecvPacketPostCrypto.disconnect(sink); | |
203 } else { | |
204 SignalRecvPacketPreCrypto.disconnect(sink); | |
205 } | |
206 } | |
207 | |
208 bool HasRecvSinks(SinkType type) { | |
209 rtc::CritScope cs(&signal_recv_packet_cs_); | |
210 if (SINK_POST_CRYPTO == type) { | |
211 return !SignalRecvPacketPostCrypto.is_empty(); | |
212 } else { | |
213 return !SignalRecvPacketPreCrypto.is_empty(); | |
214 } | |
215 } | |
216 | |
217 BundleFilter* bundle_filter() { return &bundle_filter_; } | 151 BundleFilter* bundle_filter() { return &bundle_filter_; } |
218 | 152 |
219 const std::vector<StreamParams>& local_streams() const { | 153 const std::vector<StreamParams>& local_streams() const { |
220 return local_streams_; | 154 return local_streams_; |
221 } | 155 } |
222 const std::vector<StreamParams>& remote_streams() const { | 156 const std::vector<StreamParams>& remote_streams() const { |
223 return remote_streams_; | 157 return remote_streams_; |
224 } | 158 } |
225 | 159 |
226 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; | 160 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, | 304 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, |
371 const std::vector<ConnectionInfo>& infos) = 0; | 305 const std::vector<ConnectionInfo>& infos) = 0; |
372 | 306 |
373 // Helper function for invoking bool-returning methods on the worker thread. | 307 // Helper function for invoking bool-returning methods on the worker thread. |
374 template <class FunctorT> | 308 template <class FunctorT> |
375 bool InvokeOnWorker(const FunctorT& functor) { | 309 bool InvokeOnWorker(const FunctorT& functor) { |
376 return worker_thread_->Invoke<bool>(functor); | 310 return worker_thread_->Invoke<bool>(functor); |
377 } | 311 } |
378 | 312 |
379 private: | 313 private: |
380 sigslot::signal3<const void*, size_t, bool> SignalSendPacketPreCrypto; | |
381 sigslot::signal3<const void*, size_t, bool> SignalSendPacketPostCrypto; | |
382 sigslot::signal3<const void*, size_t, bool> SignalRecvPacketPreCrypto; | |
383 sigslot::signal3<const void*, size_t, bool> SignalRecvPacketPostCrypto; | |
384 rtc::CriticalSection signal_send_packet_cs_; | |
385 rtc::CriticalSection signal_recv_packet_cs_; | |
386 | |
387 rtc::Thread* worker_thread_; | 314 rtc::Thread* worker_thread_; |
388 MediaEngineInterface* media_engine_; | 315 MediaEngineInterface* media_engine_; |
389 BaseSession* session_; | 316 BaseSession* session_; |
390 MediaChannel* media_channel_; | 317 MediaChannel* media_channel_; |
391 std::vector<StreamParams> local_streams_; | 318 std::vector<StreamParams> local_streams_; |
392 std::vector<StreamParams> remote_streams_; | 319 std::vector<StreamParams> remote_streams_; |
393 | 320 |
394 const std::string content_name_; | 321 const std::string content_name_; |
395 bool rtcp_; | 322 bool rtcp_; |
396 TransportChannel* transport_channel_; | 323 TransportChannel* transport_channel_; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; | 654 rtc::scoped_ptr<DataMediaMonitor> media_monitor_; |
728 // TODO(pthatcher): Make a separate SctpDataChannel and | 655 // TODO(pthatcher): Make a separate SctpDataChannel and |
729 // RtpDataChannel instead of using this. | 656 // RtpDataChannel instead of using this. |
730 DataChannelType data_channel_type_; | 657 DataChannelType data_channel_type_; |
731 bool ready_to_send_data_; | 658 bool ready_to_send_data_; |
732 }; | 659 }; |
733 | 660 |
734 } // namespace cricket | 661 } // namespace cricket |
735 | 662 |
736 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ | 663 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ |
OLD | NEW |