| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! | 63 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! |
| 64 // This is required to avoid a data race between the destructor modifying the | 64 // This is required to avoid a data race between the destructor modifying the |
| 65 // vtable, and the media channel's thread using BaseChannel as the | 65 // vtable, and the media channel's thread using BaseChannel as the |
| 66 // NetworkInterface. | 66 // NetworkInterface. |
| 67 | 67 |
| 68 class BaseChannel | 68 class BaseChannel |
| 69 : public rtc::MessageHandler, public sigslot::has_slots<>, | 69 : public rtc::MessageHandler, public sigslot::has_slots<>, |
| 70 public MediaChannel::NetworkInterface, | 70 public MediaChannel::NetworkInterface, |
| 71 public ConnectionStatsGetter { | 71 public ConnectionStatsGetter { |
| 72 public: | 72 public: |
| 73 // |rtcp| represents whether or not this channel uses RTCP. |
| 73 BaseChannel(rtc::Thread* worker_thread, | 74 BaseChannel(rtc::Thread* worker_thread, |
| 74 rtc::Thread* network_thread, | 75 rtc::Thread* network_thread, |
| 75 MediaChannel* channel, | 76 MediaChannel* channel, |
| 76 TransportController* transport_controller, | 77 TransportController* transport_controller, |
| 77 const std::string& content_name, | 78 const std::string& content_name, |
| 78 bool rtcp); | 79 bool rtcp); |
| 79 virtual ~BaseChannel(); | 80 virtual ~BaseChannel(); |
| 80 bool Init_w(const std::string* bundle_transport_name); | 81 bool Init_w(const std::string* bundle_transport_name); |
| 81 // Deinit may be called multiple times and is simply ignored if it's already | 82 // Deinit may be called multiple times and is simply ignored if it's already |
| 82 // done. | 83 // done. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 remote_content_direction_ = direction; | 191 remote_content_direction_ = direction; |
| 191 } | 192 } |
| 192 void set_secure_required(bool secure_required) { | 193 void set_secure_required(bool secure_required) { |
| 193 secure_required_ = secure_required; | 194 secure_required_ = secure_required; |
| 194 } | 195 } |
| 195 bool IsReadyToReceive_w() const; | 196 bool IsReadyToReceive_w() const; |
| 196 bool IsReadyToSend_w() const; | 197 bool IsReadyToSend_w() const; |
| 197 rtc::Thread* signaling_thread() { | 198 rtc::Thread* signaling_thread() { |
| 198 return transport_controller_->signaling_thread(); | 199 return transport_controller_->signaling_thread(); |
| 199 } | 200 } |
| 200 bool rtcp_transport_enabled() const { return rtcp_transport_enabled_; } | |
| 201 | 201 |
| 202 void ConnectToTransportChannel(TransportChannel* tc); | 202 void ConnectToTransportChannel(TransportChannel* tc); |
| 203 void DisconnectFromTransportChannel(TransportChannel* tc); | 203 void DisconnectFromTransportChannel(TransportChannel* tc); |
| 204 | 204 |
| 205 void FlushRtcpMessages_n(); | 205 void FlushRtcpMessages_n(); |
| 206 | 206 |
| 207 // NetworkInterface implementation, called by MediaEngine | 207 // NetworkInterface implementation, called by MediaEngine |
| 208 bool SendPacket(rtc::CopyOnWriteBuffer* packet, | 208 bool SendPacket(rtc::CopyOnWriteBuffer* packet, |
| 209 const rtc::PacketOptions& options) override; | 209 const rtc::PacketOptions& options) override; |
| 210 bool SendRtcp(rtc::CopyOnWriteBuffer* packet, | 210 bool SendRtcp(rtc::CopyOnWriteBuffer* packet, |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 rtc::Thread* const worker_thread_; | 335 rtc::Thread* const worker_thread_; |
| 336 rtc::Thread* const network_thread_; | 336 rtc::Thread* const network_thread_; |
| 337 rtc::AsyncInvoker invoker_; | 337 rtc::AsyncInvoker invoker_; |
| 338 | 338 |
| 339 const std::string content_name_; | 339 const std::string content_name_; |
| 340 std::unique_ptr<ConnectionMonitor> connection_monitor_; | 340 std::unique_ptr<ConnectionMonitor> connection_monitor_; |
| 341 | 341 |
| 342 // Transport related members that should be accessed from network thread. | 342 // Transport related members that should be accessed from network thread. |
| 343 TransportController* const transport_controller_; | 343 TransportController* const transport_controller_; |
| 344 std::string transport_name_; | 344 std::string transport_name_; |
| 345 bool rtcp_transport_enabled_; | 345 // Is RTCP used at all by this type of channel? |
| 346 TransportChannel* transport_channel_; | 346 // Expected to be true (as of typing this) for everything except data |
| 347 // channels. |
| 348 const bool rtcp_enabled_; |
| 349 TransportChannel* transport_channel_ = nullptr; |
| 347 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; | 350 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
| 348 TransportChannel* rtcp_transport_channel_; | 351 TransportChannel* rtcp_transport_channel_ = nullptr; |
| 349 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; | 352 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; |
| 350 SrtpFilter srtp_filter_; | 353 SrtpFilter srtp_filter_; |
| 351 RtcpMuxFilter rtcp_mux_filter_; | 354 RtcpMuxFilter rtcp_mux_filter_; |
| 352 BundleFilter bundle_filter_; | 355 BundleFilter bundle_filter_; |
| 353 bool rtp_ready_to_send_; | 356 bool rtp_ready_to_send_ = false; |
| 354 bool rtcp_ready_to_send_; | 357 bool rtcp_ready_to_send_ = false; |
| 355 bool writable_; | 358 bool writable_ = false; |
| 356 bool was_ever_writable_; | 359 bool was_ever_writable_ = false; |
| 357 bool has_received_packet_; | 360 bool has_received_packet_ = false; |
| 358 bool dtls_keyed_; | 361 bool dtls_keyed_ = false; |
| 359 bool secure_required_; | 362 bool secure_required_ = false; |
| 360 rtc::CryptoOptions crypto_options_; | 363 rtc::CryptoOptions crypto_options_; |
| 361 int rtp_abs_sendtime_extn_id_; | 364 int rtp_abs_sendtime_extn_id_ = -1; |
| 362 | 365 |
| 363 // MediaChannel related members that should be access from worker thread. | 366 // MediaChannel related members that should be access from worker thread. |
| 364 MediaChannel* const media_channel_; | 367 MediaChannel* const media_channel_; |
| 365 // Currently enabled_ flag accessed from signaling thread too, but it can | 368 // Currently enabled_ flag accessed from signaling thread too, but it can |
| 366 // be changed only when signaling thread does sunchronious call to worker | 369 // be changed only when signaling thread does sunchronious call to worker |
| 367 // thread, so it should be safe. | 370 // thread, so it should be safe. |
| 368 bool enabled_; | 371 bool enabled_ = false; |
| 369 std::vector<StreamParams> local_streams_; | 372 std::vector<StreamParams> local_streams_; |
| 370 std::vector<StreamParams> remote_streams_; | 373 std::vector<StreamParams> remote_streams_; |
| 371 MediaContentDirection local_content_direction_; | 374 MediaContentDirection local_content_direction_ = MD_INACTIVE; |
| 372 MediaContentDirection remote_content_direction_; | 375 MediaContentDirection remote_content_direction_ = MD_INACTIVE; |
| 373 }; | 376 }; |
| 374 | 377 |
| 375 // VoiceChannel is a specialization that adds support for early media, DTMF, | 378 // VoiceChannel is a specialization that adds support for early media, DTMF, |
| 376 // and input/output level monitoring. | 379 // and input/output level monitoring. |
| 377 class VoiceChannel : public BaseChannel { | 380 class VoiceChannel : public BaseChannel { |
| 378 public: | 381 public: |
| 379 VoiceChannel(rtc::Thread* worker_thread, | 382 VoiceChannel(rtc::Thread* worker_thread, |
| 380 rtc::Thread* network_thread, | 383 rtc::Thread* network_thread, |
| 381 MediaEngineInterface* media_engine, | 384 MediaEngineInterface* media_engine, |
| 382 VoiceMediaChannel* channel, | 385 VoiceMediaChannel* channel, |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 // SetSendParameters. | 690 // SetSendParameters. |
| 688 DataSendParameters last_send_params_; | 691 DataSendParameters last_send_params_; |
| 689 // Last DataRecvParameters sent down to the media_channel() via | 692 // Last DataRecvParameters sent down to the media_channel() via |
| 690 // SetRecvParameters. | 693 // SetRecvParameters. |
| 691 DataRecvParameters last_recv_params_; | 694 DataRecvParameters last_recv_params_; |
| 692 }; | 695 }; |
| 693 | 696 |
| 694 } // namespace cricket | 697 } // namespace cricket |
| 695 | 698 |
| 696 #endif // WEBRTC_PC_CHANNEL_H_ | 699 #endif // WEBRTC_PC_CHANNEL_H_ |
| OLD | NEW |