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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 const std::string& transport_name() const { return transport_name_; } | 93 const std::string& transport_name() const { return transport_name_; } |
94 TransportChannel* transport_channel() const { | 94 TransportChannel* transport_channel() const { |
95 return transport_channel_; | 95 return transport_channel_; |
96 } | 96 } |
97 TransportChannel* rtcp_transport_channel() const { | 97 TransportChannel* rtcp_transport_channel() const { |
98 return rtcp_transport_channel_; | 98 return rtcp_transport_channel_; |
99 } | 99 } |
100 bool enabled() const { return enabled_; } | 100 bool enabled() const { return enabled_; } |
101 | 101 |
102 // This function returns true if we are using SRTP. | 102 // This function returns true if we are using SRTP. |
103 bool secure() const { return srtp_filter_.IsActive(); } | 103 bool secure() const { return srtp_filter_->IsActive(); } |
104 // The following function returns true if we are using | 104 // The following function returns true if we are using |
105 // DTLS-based keying. If you turned off SRTP later, however | 105 // DTLS-based keying. If you turned off SRTP later, however |
106 // you could have secure() == false and dtls_secure() == true. | 106 // you could have secure() == false and dtls_secure() == true. |
107 bool secure_dtls() const { return dtls_keyed_; } | 107 bool secure_dtls() const { return dtls_keyed_; } |
108 // This function returns true if we require secure channel for call setup. | 108 // This function returns true if we require secure channel for call setup. |
109 bool secure_required() const { return secure_required_; } | 109 bool secure_required() const { return secure_required_; } |
110 | 110 |
111 bool writable() const { return writable_; } | 111 bool writable() const { return writable_; } |
112 | 112 |
113 // Activate RTCP mux, regardless of the state so far. Once | 113 // Activate RTCP mux, regardless of the state so far. Once |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // Used for latency measurements. | 160 // Used for latency measurements. |
161 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; | 161 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; |
162 | 162 |
163 // Made public for easier testing. | 163 // Made public for easier testing. |
164 void SetReadyToSend(bool rtcp, bool ready); | 164 void SetReadyToSend(bool rtcp, bool ready); |
165 | 165 |
166 // Only public for unit tests. Otherwise, consider protected. | 166 // Only public for unit tests. Otherwise, consider protected. |
167 int SetOption(SocketType type, rtc::Socket::Option o, int val) | 167 int SetOption(SocketType type, rtc::Socket::Option o, int val) |
168 override; | 168 override; |
169 | 169 |
170 SrtpFilter* srtp_filter() { return &srtp_filter_; } | 170 SrtpFilter* srtp_filter() { return srtp_filter_.get(); } |
171 | 171 |
172 protected: | 172 protected: |
173 virtual MediaChannel* media_channel() const { return media_channel_; } | 173 virtual MediaChannel* media_channel() const { return media_channel_; } |
174 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is | 174 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is |
175 // true). Gets the transport channels from |transport_controller_|. | 175 // true). Gets the transport channels from |transport_controller_|. |
176 bool SetTransport_w(const std::string& transport_name); | 176 bool SetTransport_w(const std::string& transport_name); |
177 void set_transport_channel(TransportChannel* transport); | 177 void set_transport_channel(TransportChannel* transport); |
178 void set_rtcp_transport_channel(TransportChannel* transport); | 178 void set_rtcp_transport_channel(TransportChannel* transport); |
179 bool was_ever_writable() const { return was_ever_writable_; } | 179 bool was_ever_writable() const { return was_ever_writable_; } |
180 void set_local_content_direction(MediaContentDirection direction) { | 180 void set_local_content_direction(MediaContentDirection direction) { |
(...skipping 25 matching lines...) Expand all Loading... |
206 | 206 |
207 // From TransportChannel | 207 // From TransportChannel |
208 void OnWritableState(TransportChannel* channel); | 208 void OnWritableState(TransportChannel* channel); |
209 virtual void OnChannelRead(TransportChannel* channel, | 209 virtual void OnChannelRead(TransportChannel* channel, |
210 const char* data, | 210 const char* data, |
211 size_t len, | 211 size_t len, |
212 const rtc::PacketTime& packet_time, | 212 const rtc::PacketTime& packet_time, |
213 int flags); | 213 int flags); |
214 void OnReadyToSend(TransportChannel* channel); | 214 void OnReadyToSend(TransportChannel* channel); |
215 | 215 |
| 216 void OnDtlsSrtpSetup(TransportChannel* channel); |
| 217 |
216 bool PacketIsRtcp(const TransportChannel* channel, const char* data, | 218 bool PacketIsRtcp(const TransportChannel* channel, const char* data, |
217 size_t len); | 219 size_t len); |
218 bool SendPacket(bool rtcp, | 220 bool SendPacket(bool rtcp, |
219 rtc::Buffer* packet, | 221 rtc::Buffer* packet, |
220 const rtc::PacketOptions& options); | 222 const rtc::PacketOptions& options); |
221 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); | 223 virtual bool WantsPacket(bool rtcp, rtc::Buffer* packet); |
222 void HandlePacket(bool rtcp, rtc::Buffer* packet, | 224 void HandlePacket(bool rtcp, rtc::Buffer* packet, |
223 const rtc::PacketTime& packet_time); | 225 const rtc::PacketTime& packet_time); |
224 | 226 |
225 void EnableMedia_w(); | 227 void EnableMedia_w(); |
226 void DisableMedia_w(); | 228 void DisableMedia_w(); |
227 void UpdateWritableState_w(); | 229 void UpdateWritableState_w(); |
228 void ChannelWritable_w(); | 230 void ChannelWritable_w(); |
229 void ChannelNotWritable_w(); | 231 void ChannelNotWritable_w(); |
230 bool AddRecvStream_w(const StreamParams& sp); | 232 bool AddRecvStream_w(const StreamParams& sp); |
231 bool RemoveRecvStream_w(uint32_t ssrc); | 233 bool RemoveRecvStream_w(uint32_t ssrc); |
232 bool AddSendStream_w(const StreamParams& sp); | 234 bool AddSendStream_w(const StreamParams& sp); |
233 bool RemoveSendStream_w(uint32_t ssrc); | 235 bool RemoveSendStream_w(uint32_t ssrc); |
234 virtual bool ShouldSetupDtlsSrtp() const; | 236 virtual bool ShouldSetupDtlsSrtp() const; |
| 237 bool IsUsingDtlsSrtp() const; |
235 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. | 238 // Do the DTLS key expansion and impose it on the SRTP/SRTCP filters. |
236 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. | 239 // |rtcp_channel| indicates whether to set up the RTP or RTCP filter. |
237 bool SetupDtlsSrtp(bool rtcp_channel); | 240 bool SetupDtlsSrtp(bool rtcp_channel); |
238 // Set the DTLS-SRTP cipher policy on this channel as appropriate. | 241 // Set the DTLS-SRTP cipher policy on this channel as appropriate. |
239 bool SetDtlsSrtpCiphers(TransportChannel *tc, bool rtcp); | 242 bool SetDtlsSrtpCiphers(TransportChannel *tc, bool rtcp); |
240 | 243 |
241 virtual void ChangeState() = 0; | 244 virtual void ChangeState() = 0; |
242 | 245 |
243 // Gets the content info appropriate to the channel (audio or video). | 246 // Gets the content info appropriate to the channel (audio or video). |
244 virtual const ContentInfo* GetFirstContent( | 247 virtual const ContentInfo* GetFirstContent( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 std::vector<StreamParams> local_streams_; | 304 std::vector<StreamParams> local_streams_; |
302 std::vector<StreamParams> remote_streams_; | 305 std::vector<StreamParams> remote_streams_; |
303 | 306 |
304 const std::string content_name_; | 307 const std::string content_name_; |
305 std::string transport_name_; | 308 std::string transport_name_; |
306 bool rtcp_transport_enabled_; | 309 bool rtcp_transport_enabled_; |
307 TransportChannel* transport_channel_; | 310 TransportChannel* transport_channel_; |
308 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; | 311 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
309 TransportChannel* rtcp_transport_channel_; | 312 TransportChannel* rtcp_transport_channel_; |
310 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; | 313 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; |
311 SrtpFilter srtp_filter_; | 314 rtc::scoped_ptr<SrtpFilter> srtp_filter_; |
312 RtcpMuxFilter rtcp_mux_filter_; | 315 RtcpMuxFilter rtcp_mux_filter_; |
313 BundleFilter bundle_filter_; | 316 BundleFilter bundle_filter_; |
314 rtc::scoped_ptr<ConnectionMonitor> connection_monitor_; | 317 rtc::scoped_ptr<ConnectionMonitor> connection_monitor_; |
315 bool enabled_; | 318 bool enabled_; |
316 bool writable_; | 319 bool writable_; |
317 bool rtp_ready_to_send_; | 320 bool rtp_ready_to_send_; |
318 bool rtcp_ready_to_send_; | 321 bool rtcp_ready_to_send_; |
319 bool was_ever_writable_; | 322 bool was_ever_writable_; |
320 MediaContentDirection local_content_direction_; | 323 MediaContentDirection local_content_direction_; |
321 MediaContentDirection remote_content_direction_; | 324 MediaContentDirection remote_content_direction_; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 // SetSendParameters. | 639 // SetSendParameters. |
637 DataSendParameters last_send_params_; | 640 DataSendParameters last_send_params_; |
638 // Last DataRecvParameters sent down to the media_channel() via | 641 // Last DataRecvParameters sent down to the media_channel() via |
639 // SetRecvParameters. | 642 // SetRecvParameters. |
640 DataRecvParameters last_recv_params_; | 643 DataRecvParameters last_recv_params_; |
641 }; | 644 }; |
642 | 645 |
643 } // namespace cricket | 646 } // namespace cricket |
644 | 647 |
645 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ | 648 #endif // TALK_SESSION_MEDIA_CHANNEL_H_ |
OLD | NEW |