Chromium Code Reviews| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 void SignalDtlsSrtpSetupFailure_n(bool rtcp); | 153 void SignalDtlsSrtpSetupFailure_n(bool rtcp); |
| 154 void SignalDtlsSrtpSetupFailure_s(bool rtcp); | 154 void SignalDtlsSrtpSetupFailure_s(bool rtcp); |
| 155 | 155 |
| 156 // Used for latency measurements. | 156 // Used for latency measurements. |
| 157 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; | 157 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; |
| 158 | 158 |
| 159 // Forward TransportChannel SignalSentPacket to worker thread. | 159 // Forward TransportChannel SignalSentPacket to worker thread. |
| 160 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket; | 160 sigslot::signal1<const rtc::SentPacket&> SignalSentPacket; |
| 161 | 161 |
| 162 // Only public for unit tests. Otherwise, consider private. | 162 // Only public for unit tests. Otherwise, consider private. |
| 163 TransportChannel* transport_channel() const { return transport_channel_; } | 163 DtlsTransportInternal* transport_channel() const { |
| 164 TransportChannel* rtcp_transport_channel() const { | 164 return transport_channel_; |
| 165 } | |
| 166 DtlsTransportInternal* rtcp_transport_channel() const { | |
|
pthatcher1
2017/01/13 22:41:16
We should call these rtp_dtls_transport and rtcp_d
Zhi Huang
2017/01/16 10:38:25
Done.
| |
| 165 return rtcp_transport_channel_; | 167 return rtcp_transport_channel_; |
| 166 } | 168 } |
| 167 | 169 |
| 168 // Made public for easier testing. | 170 // Made public for easier testing. |
| 169 // | 171 // |
| 170 // Updates "ready to send" for an individual channel, and informs the media | 172 // Updates "ready to send" for an individual channel, and informs the media |
| 171 // channel that the transport is ready to send if each channel (in use) is | 173 // channel that the transport is ready to send if each channel (in use) is |
| 172 // ready to send. This is more specific than just "writable"; it means the | 174 // ready to send. This is more specific than just "writable"; it means the |
| 173 // last send didn't return ENOTCONN. | 175 // last send didn't return ENOTCONN. |
| 174 // | 176 // |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 194 virtual MediaChannel* media_channel() const { return media_channel_; } | 196 virtual MediaChannel* media_channel() const { return media_channel_; } |
| 195 | 197 |
| 196 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if | 198 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |
| 197 // |rtcp_enabled_| is true). Gets the transport channels from | 199 // |rtcp_enabled_| is true). Gets the transport channels from |
| 198 // |transport_controller_|. | 200 // |transport_controller_|. |
| 199 // This method also updates writability and "ready-to-send" state. | 201 // This method also updates writability and "ready-to-send" state. |
| 200 bool SetTransport_n(const std::string& transport_name); | 202 bool SetTransport_n(const std::string& transport_name); |
| 201 | 203 |
| 202 // This does not update writability or "ready-to-send" state; it just | 204 // This does not update writability or "ready-to-send" state; it just |
| 203 // disconnects from the old channel and connects to the new one. | 205 // disconnects from the old channel and connects to the new one. |
| 204 void SetTransportChannel_n(bool rtcp, TransportChannel* new_channel); | 206 void SetTransportChannel_n(bool rtcp, DtlsTransportInternal* new_channel); |
| 205 | 207 |
| 206 bool was_ever_writable() const { return was_ever_writable_; } | 208 bool was_ever_writable() const { return was_ever_writable_; } |
| 207 void set_local_content_direction(MediaContentDirection direction) { | 209 void set_local_content_direction(MediaContentDirection direction) { |
| 208 local_content_direction_ = direction; | 210 local_content_direction_ = direction; |
| 209 } | 211 } |
| 210 void set_remote_content_direction(MediaContentDirection direction) { | 212 void set_remote_content_direction(MediaContentDirection direction) { |
| 211 remote_content_direction_ = direction; | 213 remote_content_direction_ = direction; |
| 212 } | 214 } |
| 213 // These methods verify that: | 215 // These methods verify that: |
| 214 // * The required content description directions have been set. | 216 // * The required content description directions have been set. |
| 215 // * The channel is enabled. | 217 // * The channel is enabled. |
| 216 // * And for sending: | 218 // * And for sending: |
| 217 // - The SRTP filter is active if it's needed. | 219 // - The SRTP filter is active if it's needed. |
| 218 // - The transport has been writable before, meaning it should be at least | 220 // - The transport has been writable before, meaning it should be at least |
| 219 // possible to succeed in sending a packet. | 221 // possible to succeed in sending a packet. |
| 220 // | 222 // |
| 221 // When any of these properties change, UpdateMediaSendRecvState_w should be | 223 // When any of these properties change, UpdateMediaSendRecvState_w should be |
| 222 // called. | 224 // called. |
| 223 bool IsReadyToReceiveMedia_w() const; | 225 bool IsReadyToReceiveMedia_w() const; |
| 224 bool IsReadyToSendMedia_w() const; | 226 bool IsReadyToSendMedia_w() const; |
| 225 rtc::Thread* signaling_thread() { | 227 rtc::Thread* signaling_thread() { |
| 226 return transport_controller_->signaling_thread(); | 228 return transport_controller_->signaling_thread(); |
| 227 } | 229 } |
| 228 | 230 |
| 229 void ConnectToTransportChannel(TransportChannel* tc); | 231 void ConnectToTransportChannel(DtlsTransportInternal* tc); |
| 230 void DisconnectFromTransportChannel(TransportChannel* tc); | 232 void DisconnectFromTransportChannel(DtlsTransportInternal* tc); |
|
pthatcher1
2017/01/13 22:41:16
This should be ConnectToTransport and DisconnectFr
Zhi Huang
2017/01/16 10:38:24
Done.
| |
| 231 | 233 |
| 232 void FlushRtcpMessages_n(); | 234 void FlushRtcpMessages_n(); |
| 233 | 235 |
| 234 // NetworkInterface implementation, called by MediaEngine | 236 // NetworkInterface implementation, called by MediaEngine |
| 235 bool SendPacket(rtc::CopyOnWriteBuffer* packet, | 237 bool SendPacket(rtc::CopyOnWriteBuffer* packet, |
| 236 const rtc::PacketOptions& options) override; | 238 const rtc::PacketOptions& options) override; |
| 237 bool SendRtcp(rtc::CopyOnWriteBuffer* packet, | 239 bool SendRtcp(rtc::CopyOnWriteBuffer* packet, |
| 238 const rtc::PacketOptions& options) override; | 240 const rtc::PacketOptions& options) override; |
| 239 | 241 |
| 240 // From TransportChannel | 242 // From TransportChannel |
| 241 void OnWritableState(rtc::PacketTransportInterface* transport); | 243 void OnWritableState(rtc::PacketTransportInterface* transport); |
| 242 virtual void OnPacketRead(rtc::PacketTransportInterface* transport, | 244 virtual void OnPacketRead(rtc::PacketTransportInterface* transport, |
| 243 const char* data, | 245 const char* data, |
| 244 size_t len, | 246 size_t len, |
| 245 const rtc::PacketTime& packet_time, | 247 const rtc::PacketTime& packet_time, |
| 246 int flags); | 248 int flags); |
| 247 void OnReadyToSend(rtc::PacketTransportInterface* transport); | 249 void OnReadyToSend(rtc::PacketTransportInterface* transport); |
| 248 | 250 |
| 249 void OnDtlsState(TransportChannel* channel, DtlsTransportState state); | 251 void OnDtlsState(DtlsTransportInternal* channel, DtlsTransportState state); |
| 250 | 252 |
| 251 void OnSelectedCandidatePairChanged( | 253 void OnSelectedCandidatePairChanged( |
| 252 TransportChannel* channel, | 254 IceTransportInternal* channel, |
| 253 CandidatePairInterface* selected_candidate_pair, | 255 CandidatePairInterface* selected_candidate_pair, |
| 254 int last_sent_packet_id, | 256 int last_sent_packet_id, |
| 255 bool ready_to_send); | 257 bool ready_to_send); |
| 256 | 258 |
| 257 bool PacketIsRtcp(const rtc::PacketTransportInterface* transport, | 259 bool PacketIsRtcp(const rtc::PacketTransportInterface* transport, |
| 258 const char* data, | 260 const char* data, |
| 259 size_t len); | 261 size_t len); |
| 260 bool SendPacket(bool rtcp, | 262 bool SendPacket(bool rtcp, |
| 261 rtc::CopyOnWriteBuffer* packet, | 263 rtc::CopyOnWriteBuffer* packet, |
| 262 const rtc::PacketOptions& options); | 264 const rtc::PacketOptions& options); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 281 bool AddRecvStream_w(const StreamParams& sp); | 283 bool AddRecvStream_w(const StreamParams& sp); |
| 282 bool RemoveRecvStream_w(uint32_t ssrc); | 284 bool RemoveRecvStream_w(uint32_t ssrc); |
| 283 bool AddSendStream_w(const StreamParams& sp); | 285 bool AddSendStream_w(const StreamParams& sp); |
| 284 bool RemoveSendStream_w(uint32_t ssrc); | 286 bool RemoveSendStream_w(uint32_t ssrc); |
| 285 bool ShouldSetupDtlsSrtp_n() const; | 287 bool ShouldSetupDtlsSrtp_n() const; |
| 286 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. | 288 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. |
| 287 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. | 289 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. |
| 288 bool SetupDtlsSrtp_n(bool rtcp_channel); | 290 bool SetupDtlsSrtp_n(bool rtcp_channel); |
| 289 void MaybeSetupDtlsSrtp_n(); | 291 void MaybeSetupDtlsSrtp_n(); |
| 290 // Set the DTLS-SRTP cipher policy on this channel as appropriate. | 292 // Set the DTLS-SRTP cipher policy on this channel as appropriate. |
| 291 bool SetDtlsSrtpCryptoSuites_n(TransportChannel* tc, bool rtcp); | 293 bool SetDtlsSrtpCryptoSuites_n(DtlsTransportInternal* tc, bool rtcp); |
| 292 | 294 |
| 293 // Should be called whenever the conditions for | 295 // Should be called whenever the conditions for |
| 294 // IsReadyToReceiveMedia/IsReadyToSendMedia are satisfied (or unsatisfied). | 296 // IsReadyToReceiveMedia/IsReadyToSendMedia are satisfied (or unsatisfied). |
| 295 // Updates the send/recv state of the media channel. | 297 // Updates the send/recv state of the media channel. |
| 296 void UpdateMediaSendRecvState(); | 298 void UpdateMediaSendRecvState(); |
| 297 virtual void UpdateMediaSendRecvState_w() = 0; | 299 virtual void UpdateMediaSendRecvState_w() = 0; |
| 298 | 300 |
| 299 // Gets the content info appropriate to the channel (audio or video). | 301 // Gets the content info appropriate to the channel (audio or video). |
| 300 virtual const ContentInfo* GetFirstContent( | 302 virtual const ContentInfo* GetFirstContent( |
| 301 const SessionDescription* sdesc) = 0; | 303 const SessionDescription* sdesc) = 0; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 std::unique_ptr<ConnectionMonitor> connection_monitor_; | 380 std::unique_ptr<ConnectionMonitor> connection_monitor_; |
| 379 | 381 |
| 380 // Transport related members that should be accessed from network thread. | 382 // Transport related members that should be accessed from network thread. |
| 381 TransportController* const transport_controller_; | 383 TransportController* const transport_controller_; |
| 382 std::string transport_name_; | 384 std::string transport_name_; |
| 383 // Is RTCP used at all by this type of channel? | 385 // Is RTCP used at all by this type of channel? |
| 384 // Expected to be true (as of typing this) for everything except data | 386 // Expected to be true (as of typing this) for everything except data |
| 385 // channels. | 387 // channels. |
| 386 const bool rtcp_enabled_; | 388 const bool rtcp_enabled_; |
| 387 // TODO(johan): Replace TransportChannel* with rtc::PacketTransportInterface*. | 389 // TODO(johan): Replace TransportChannel* with rtc::PacketTransportInterface*. |
| 388 TransportChannel* transport_channel_ = nullptr; | 390 DtlsTransportInternal* transport_channel_ = nullptr; |
| 389 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; | 391 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
| 390 TransportChannel* rtcp_transport_channel_ = nullptr; | 392 DtlsTransportInternal* rtcp_transport_channel_ = nullptr; |
|
pthatcher1
2017/01/13 22:41:16
Same here with the names.
Zhi Huang
2017/01/16 10:38:24
Done.
| |
| 391 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; | 393 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; |
| 392 SrtpFilter srtp_filter_; | 394 SrtpFilter srtp_filter_; |
| 393 RtcpMuxFilter rtcp_mux_filter_; | 395 RtcpMuxFilter rtcp_mux_filter_; |
| 394 BundleFilter bundle_filter_; | 396 BundleFilter bundle_filter_; |
| 395 bool rtp_ready_to_send_ = false; | 397 bool rtp_ready_to_send_ = false; |
| 396 bool rtcp_ready_to_send_ = false; | 398 bool rtcp_ready_to_send_ = false; |
| 397 bool writable_ = false; | 399 bool writable_ = false; |
| 398 bool was_ever_writable_ = false; | 400 bool was_ever_writable_ = false; |
| 399 bool has_received_packet_ = false; | 401 bool has_received_packet_ = false; |
| 400 bool dtls_keyed_ = false; | 402 bool dtls_keyed_ = false; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 722 // SetSendParameters. | 724 // SetSendParameters. |
| 723 DataSendParameters last_send_params_; | 725 DataSendParameters last_send_params_; |
| 724 // Last DataRecvParameters sent down to the media_channel() via | 726 // Last DataRecvParameters sent down to the media_channel() via |
| 725 // SetRecvParameters. | 727 // SetRecvParameters. |
| 726 DataRecvParameters last_recv_params_; | 728 DataRecvParameters last_recv_params_; |
| 727 }; | 729 }; |
| 728 | 730 |
| 729 } // namespace cricket | 731 } // namespace cricket |
| 730 | 732 |
| 731 #endif // WEBRTC_PC_CHANNEL_H_ | 733 #endif // WEBRTC_PC_CHANNEL_H_ |
| OLD | NEW |