| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 namespace webrtc { | 41 namespace webrtc { |
| 42 class AudioSinkInterface; | 42 class AudioSinkInterface; |
| 43 } // namespace webrtc | 43 } // namespace webrtc |
| 44 | 44 |
| 45 namespace cricket { | 45 namespace cricket { |
| 46 | 46 |
| 47 struct CryptoParams; | 47 struct CryptoParams; |
| 48 class MediaContentDescription; | 48 class MediaContentDescription; |
| 49 | 49 |
| 50 enum SinkType { | |
| 51 SINK_PRE_CRYPTO, // Sink packets before encryption or after decryption. | |
| 52 SINK_POST_CRYPTO // Sink packets after encryption or before decryption. | |
| 53 }; | |
| 54 | |
| 55 // BaseChannel contains logic common to voice and video, including | 50 // BaseChannel contains logic common to voice and video, including |
| 56 // enable, marshaling calls to a worker thread, and | 51 // enable, marshaling calls to a worker thread, and |
| 57 // connection and media monitors. | 52 // connection and media monitors. |
| 58 // | 53 // |
| 59 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! | 54 // WARNING! SUBCLASSES MUST CALL Deinit() IN THEIR DESTRUCTORS! |
| 60 // This is required to avoid a data race between the destructor modifying the | 55 // This is required to avoid a data race between the destructor modifying the |
| 61 // vtable, and the media channel's thread using BaseChannel as the | 56 // vtable, and the media channel's thread using BaseChannel as the |
| 62 // NetworkInterface. | 57 // NetworkInterface. |
| 63 | 58 |
| 64 class BaseChannel | 59 class BaseChannel |
| 65 : public rtc::MessageHandler, public sigslot::has_slots<>, | 60 : public rtc::MessageHandler, public sigslot::has_slots<>, |
| 66 public MediaChannel::NetworkInterface, | 61 public MediaChannel::NetworkInterface, |
| 67 public ConnectionStatsGetter { | 62 public ConnectionStatsGetter { |
| 68 public: | 63 public: |
| 69 BaseChannel(rtc::Thread* thread, | 64 BaseChannel(rtc::Thread* worker_thread, |
| 65 rtc::Thread* network_thread, |
| 70 MediaChannel* channel, | 66 MediaChannel* channel, |
| 71 TransportController* transport_controller, | 67 TransportController* transport_controller, |
| 72 const std::string& content_name, | 68 const std::string& content_name, |
| 73 bool rtcp); | 69 bool rtcp); |
| 74 virtual ~BaseChannel(); | 70 virtual ~BaseChannel(); |
| 75 bool Init(); | 71 bool Init(); |
| 76 // Deinit may be called multiple times and is simply ignored if it's alreay | 72 // Deinit may be called multiple times and is simply ignored if it's alreay |
| 77 // done. | 73 // done. |
| 78 void Deinit(); | 74 void Deinit(); |
| 79 | 75 |
| 80 rtc::Thread* worker_thread() const { return worker_thread_; } | 76 rtc::Thread* worker_thread() const { return worker_thread_; } |
| 77 rtc::Thread* network_thread() const { return network_thread_; } |
| 81 const std::string& content_name() const { return content_name_; } | 78 const std::string& content_name() const { return content_name_; } |
| 82 const std::string& transport_name() const { return transport_name_; } | 79 const std::string& transport_name() const { return transport_name_; } |
| 83 TransportChannel* transport_channel() const { | 80 TransportChannel* transport_channel() const { |
| 84 return transport_channel_; | 81 return transport_channel_; |
| 85 } | 82 } |
| 86 TransportChannel* rtcp_transport_channel() const { | 83 TransportChannel* rtcp_transport_channel() const { |
| 87 return rtcp_transport_channel_; | 84 return rtcp_transport_channel_; |
| 88 } | 85 } |
| 89 bool enabled() const { return enabled_; } | 86 bool enabled() const { return enabled_; } |
| 90 | 87 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 BundleFilter* bundle_filter() { return &bundle_filter_; } | 133 BundleFilter* bundle_filter() { return &bundle_filter_; } |
| 137 | 134 |
| 138 const std::vector<StreamParams>& local_streams() const { | 135 const std::vector<StreamParams>& local_streams() const { |
| 139 return local_streams_; | 136 return local_streams_; |
| 140 } | 137 } |
| 141 const std::vector<StreamParams>& remote_streams() const { | 138 const std::vector<StreamParams>& remote_streams() const { |
| 142 return remote_streams_; | 139 return remote_streams_; |
| 143 } | 140 } |
| 144 | 141 |
| 145 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; | 142 sigslot::signal2<BaseChannel*, bool> SignalDtlsSetupFailure; |
| 146 void SignalDtlsSetupFailure_w(bool rtcp); | 143 void SignalDtlsSetupFailure_n(bool rtcp); |
| 147 void SignalDtlsSetupFailure_s(bool rtcp); | 144 void SignalDtlsSetupFailure_s(bool rtcp); |
| 148 | 145 |
| 149 // Used for latency measurements. | 146 // Used for latency measurements. |
| 150 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; | 147 sigslot::signal1<BaseChannel*> SignalFirstPacketReceived; |
| 151 | 148 |
| 152 // Made public for easier testing. | 149 // Made public for easier testing. |
| 153 void SetReadyToSend(bool rtcp, bool ready); | 150 void SetReadyToSend_n(bool rtcp, bool ready); |
| 154 | 151 |
| 155 // Only public for unit tests. Otherwise, consider protected. | 152 // Only public for unit tests. Otherwise, consider protected. |
| 156 int SetOption(SocketType type, rtc::Socket::Option o, int val) | 153 int SetOption(SocketType type, rtc::Socket::Option o, int val) |
| 157 override; | 154 override; |
| 158 | 155 |
| 159 SrtpFilter* srtp_filter() { return &srtp_filter_; } | 156 SrtpFilter* srtp_filter() { return &srtp_filter_; } |
| 160 | 157 |
| 158 bool SetRtpTransportParameters_n(const MediaContentDescription* content, |
| 159 ContentAction action, |
| 160 ContentSource src, |
| 161 std::string* error_desc); |
| 162 |
| 161 protected: | 163 protected: |
| 162 virtual MediaChannel* media_channel() const { return media_channel_; } | 164 virtual MediaChannel* media_channel() const { return media_channel_; } |
| 163 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is | 165 // Sets the |transport_channel_| (and |rtcp_transport_channel_|, if |rtcp_| is |
| 164 // true). Gets the transport channels from |transport_controller_|. | 166 // true). Gets the transport channels from |transport_controller_|. |
| 165 bool SetTransport_w(const std::string& transport_name); | 167 bool SetTransport_n(const std::string& transport_name); |
| 166 | 168 |
| 167 void set_transport_channel(TransportChannel* transport); | 169 void set_transport_channel(const std::string& transport_name); |
| 168 void set_rtcp_transport_channel(TransportChannel* transport, | 170 void set_rtcp_transport_channel(const std::string* transport_name, |
| 169 bool update_writablity); | 171 bool update_writablity); |
| 170 | 172 |
| 171 bool was_ever_writable() const { return was_ever_writable_; } | 173 bool was_ever_writable() const { return was_ever_writable_; } |
| 172 void set_local_content_direction(MediaContentDirection direction) { | 174 void set_local_content_direction(MediaContentDirection direction) { |
| 173 local_content_direction_ = direction; | 175 local_content_direction_ = direction; |
| 174 } | 176 } |
| 175 void set_remote_content_direction(MediaContentDirection direction) { | 177 void set_remote_content_direction(MediaContentDirection direction) { |
| 176 remote_content_direction_ = direction; | 178 remote_content_direction_ = direction; |
| 177 } | 179 } |
| 178 void set_secure_required(bool secure_required) { | 180 void set_secure_required(bool secure_required) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 void OnSelectedCandidatePairChanged( | 212 void OnSelectedCandidatePairChanged( |
| 211 TransportChannel* channel, | 213 TransportChannel* channel, |
| 212 CandidatePairInterface* selected_candidate_pair, | 214 CandidatePairInterface* selected_candidate_pair, |
| 213 int last_sent_packet_id); | 215 int last_sent_packet_id); |
| 214 | 216 |
| 215 bool PacketIsRtcp(const TransportChannel* channel, const char* data, | 217 bool PacketIsRtcp(const TransportChannel* channel, const char* data, |
| 216 size_t len); | 218 size_t len); |
| 217 bool SendPacket(bool rtcp, | 219 bool SendPacket(bool rtcp, |
| 218 rtc::CopyOnWriteBuffer* packet, | 220 rtc::CopyOnWriteBuffer* packet, |
| 219 const rtc::PacketOptions& options); | 221 const rtc::PacketOptions& options); |
| 222 |
| 220 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); | 223 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); |
| 221 void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, | 224 void HandlePacket(bool rtcp, |
| 225 rtc::CopyOnWriteBuffer* packet, |
| 222 const rtc::PacketTime& packet_time); | 226 const rtc::PacketTime& packet_time); |
| 223 | 227 |
| 224 void EnableMedia_w(); | 228 void EnableMedia_w(); |
| 225 void DisableMedia_w(); | 229 void DisableMedia_w(); |
| 226 void UpdateWritableState_w(); | 230 void UpdateWritableState_n(); |
| 227 void ChannelWritable_w(); | 231 void ChannelWritable_n(); |
| 228 void ChannelNotWritable_w(); | 232 void ChannelNotWritable_n(); |
| 229 bool AddRecvStream_w(const StreamParams& sp); | 233 bool AddRecvStream_w(const StreamParams& sp); |
| 230 bool RemoveRecvStream_w(uint32_t ssrc); | 234 bool RemoveRecvStream_w(uint32_t ssrc); |
| 231 bool AddSendStream_w(const StreamParams& sp); | 235 bool AddSendStream_w(const StreamParams& sp); |
| 232 bool RemoveSendStream_w(uint32_t ssrc); | 236 bool RemoveSendStream_w(uint32_t ssrc); |
| 233 virtual bool ShouldSetupDtlsSrtp() const; | 237 virtual bool ShouldSetupDtlsSrtp() const; |
| 234 // 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. |
| 235 // |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. |
| 236 bool SetupDtlsSrtp(bool rtcp_channel); | 240 bool SetupDtlsSrtp_n(bool rtcp_channel); |
| 237 void MaybeSetupDtlsSrtp_w(); | 241 void MaybeSetupDtlsSrtp_n(); |
| 238 // Set the DTLS-SRTP cipher policy on this channel as appropriate. | 242 // Set the DTLS-SRTP cipher policy on this channel as appropriate. |
| 239 bool SetDtlsSrtpCryptoSuites(TransportChannel* tc, bool rtcp); | 243 bool SetDtlsSrtpCryptoSuites(TransportChannel* tc, bool rtcp); |
| 240 | 244 |
| 241 virtual void ChangeState() = 0; | 245 void ChangeState_n(); |
| 246 virtual void ChangeState_w() = 0; |
| 242 | 247 |
| 243 // Gets the content info appropriate to the channel (audio or video). | 248 // Gets the content info appropriate to the channel (audio or video). |
| 244 virtual const ContentInfo* GetFirstContent( | 249 virtual const ContentInfo* GetFirstContent( |
| 245 const SessionDescription* sdesc) = 0; | 250 const SessionDescription* sdesc) = 0; |
| 246 bool UpdateLocalStreams_w(const std::vector<StreamParams>& streams, | 251 bool UpdateLocalStreams_w(const std::vector<StreamParams>& streams, |
| 247 ContentAction action, | 252 ContentAction action, |
| 248 std::string* error_desc); | 253 std::string* error_desc); |
| 249 bool UpdateRemoteStreams_w(const std::vector<StreamParams>& streams, | 254 bool UpdateRemoteStreams_w(const std::vector<StreamParams>& streams, |
| 250 ContentAction action, | 255 ContentAction action, |
| 251 std::string* error_desc); | 256 std::string* error_desc); |
| 252 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 257 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
| 253 ContentAction action, | 258 ContentAction action, |
| 254 std::string* error_desc) = 0; | 259 std::string* error_desc) = 0; |
| 255 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 260 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 256 ContentAction action, | 261 ContentAction action, |
| 257 std::string* error_desc) = 0; | 262 std::string* error_desc) = 0; |
| 258 bool SetRtpTransportParameters_w(const MediaContentDescription* content, | |
| 259 ContentAction action, | |
| 260 ContentSource src, | |
| 261 std::string* error_desc); | |
| 262 | 263 |
| 263 // Helper method to get RTP Absoulute SendTime extension header id if | 264 // Helper method to get RTP Absoulute SendTime extension header id if |
| 264 // present in remote supported extensions list. | 265 // present in remote supported extensions list. |
| 265 void MaybeCacheRtpAbsSendTimeHeaderExtension( | 266 void MaybeCacheRtpAbsSendTimeHeaderExtension( |
| 266 const std::vector<RtpHeaderExtension>& extensions); | 267 const std::vector<RtpHeaderExtension>& extensions); |
| 267 | 268 |
| 268 bool CheckSrtpConfig(const std::vector<CryptoParams>& cryptos, | 269 bool CheckSrtpConfig(const std::vector<CryptoParams>& cryptos, |
| 269 bool* dtls, | 270 bool* dtls, |
| 270 std::string* error_desc); | 271 std::string* error_desc); |
| 271 bool SetSrtp_w(const std::vector<CryptoParams>& params, | 272 bool SetSrtp_n(const std::vector<CryptoParams>& params, |
| 272 ContentAction action, | 273 ContentAction action, |
| 273 ContentSource src, | 274 ContentSource src, |
| 274 std::string* error_desc); | 275 std::string* error_desc); |
| 275 void ActivateRtcpMux_w(); | 276 void ActivateRtcpMux_n(); |
| 276 bool SetRtcpMux_w(bool enable, | 277 bool SetRtcpMux_n(bool enable, |
| 277 ContentAction action, | 278 ContentAction action, |
| 278 ContentSource src, | 279 ContentSource src, |
| 279 std::string* error_desc); | 280 std::string* error_desc); |
| 280 | 281 |
| 281 // From MessageHandler | 282 // From MessageHandler |
| 282 void OnMessage(rtc::Message* pmsg) override; | 283 void OnMessage(rtc::Message* pmsg) override; |
| 283 | 284 |
| 284 // Handled in derived classes | 285 // Handled in derived classes |
| 285 // Get the SRTP crypto suites to use for RTP media | 286 // Get the SRTP crypto suites to use for RTP media |
| 286 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const = 0; | 287 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const = 0; |
| 287 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, | 288 virtual void OnConnectionMonitorUpdate(ConnectionMonitor* monitor, |
| 288 const std::vector<ConnectionInfo>& infos) = 0; | 289 const std::vector<ConnectionInfo>& infos) = 0; |
| 289 | 290 |
| 290 // Helper function for invoking bool-returning methods on the worker thread. | 291 // Helper function for invoking bool-returning methods on the worker thread. |
| 291 template <class FunctorT> | 292 template <class FunctorT> |
| 292 bool InvokeOnWorker(const FunctorT& functor) { | 293 bool InvokeOnWorker(const FunctorT& functor) { |
| 293 return worker_thread_->Invoke<bool>(functor); | 294 return worker_thread_->Invoke<bool>(functor); |
| 294 } | 295 } |
| 296 template <class FunctorT> |
| 297 bool InvokeOnNetwork(const FunctorT& functor) { |
| 298 return network_thread_->Invoke<bool>(functor); |
| 299 } |
| 295 | 300 |
| 296 private: | 301 private: |
| 297 rtc::Thread* worker_thread_; | 302 rtc::Thread* worker_thread_; |
| 303 rtc::Thread* network_thread_; |
| 298 TransportController* transport_controller_; | 304 TransportController* transport_controller_; |
| 299 MediaChannel* media_channel_; | 305 MediaChannel* media_channel_; |
| 300 std::vector<StreamParams> local_streams_; | 306 std::vector<StreamParams> local_streams_; |
| 301 std::vector<StreamParams> remote_streams_; | 307 std::vector<StreamParams> remote_streams_; |
| 302 | 308 |
| 303 const std::string content_name_; | 309 const std::string content_name_; |
| 304 std::string transport_name_; | 310 std::string transport_name_; |
| 305 bool rtcp_transport_enabled_; | 311 bool rtcp_transport_enabled_; |
| 306 TransportChannel* transport_channel_; | 312 TransportChannel* transport_channel_; |
| 307 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; | 313 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 321 bool has_received_packet_; | 327 bool has_received_packet_; |
| 322 bool dtls_keyed_; | 328 bool dtls_keyed_; |
| 323 bool secure_required_; | 329 bool secure_required_; |
| 324 int rtp_abs_sendtime_extn_id_; | 330 int rtp_abs_sendtime_extn_id_; |
| 325 }; | 331 }; |
| 326 | 332 |
| 327 // VoiceChannel is a specialization that adds support for early media, DTMF, | 333 // VoiceChannel is a specialization that adds support for early media, DTMF, |
| 328 // and input/output level monitoring. | 334 // and input/output level monitoring. |
| 329 class VoiceChannel : public BaseChannel { | 335 class VoiceChannel : public BaseChannel { |
| 330 public: | 336 public: |
| 331 VoiceChannel(rtc::Thread* thread, | 337 VoiceChannel(rtc::Thread* worker_thread, |
| 338 rtc::Thread* network_thread, |
| 332 MediaEngineInterface* media_engine, | 339 MediaEngineInterface* media_engine, |
| 333 VoiceMediaChannel* channel, | 340 VoiceMediaChannel* channel, |
| 334 TransportController* transport_controller, | 341 TransportController* transport_controller, |
| 335 const std::string& content_name, | 342 const std::string& content_name, |
| 336 bool rtcp); | 343 bool rtcp); |
| 337 ~VoiceChannel(); | 344 ~VoiceChannel(); |
| 338 bool Init(); | 345 bool Init(); |
| 339 | 346 |
| 340 // Configure sending media on the stream with SSRC |ssrc| | 347 // Configure sending media on the stream with SSRC |ssrc| |
| 341 // If there is only one sending stream SSRC 0 can be used. | 348 // If there is only one sending stream SSRC 0 can be used. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 void GetActiveStreams_w(AudioInfo::StreamList* actives); | 397 void GetActiveStreams_w(AudioInfo::StreamList* actives); |
| 391 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; | 398 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; |
| 392 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); | 399 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); |
| 393 | 400 |
| 394 private: | 401 private: |
| 395 // overrides from BaseChannel | 402 // overrides from BaseChannel |
| 396 virtual void OnChannelRead(TransportChannel* channel, | 403 virtual void OnChannelRead(TransportChannel* channel, |
| 397 const char* data, size_t len, | 404 const char* data, size_t len, |
| 398 const rtc::PacketTime& packet_time, | 405 const rtc::PacketTime& packet_time, |
| 399 int flags); | 406 int flags); |
| 400 virtual void ChangeState(); | 407 void ChangeState_w() override; |
| 401 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); | 408 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); |
| 402 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 409 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
| 403 ContentAction action, | 410 ContentAction action, |
| 404 std::string* error_desc); | 411 std::string* error_desc); |
| 405 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 412 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 406 ContentAction action, | 413 ContentAction action, |
| 407 std::string* error_desc); | 414 std::string* error_desc); |
| 408 void HandleEarlyMediaTimeout(); | 415 void HandleEarlyMediaTimeout(); |
| 409 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); | 416 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); |
| 410 bool SetOutputVolume_w(uint32_t ssrc, double volume); | 417 bool SetOutputVolume_w(uint32_t ssrc, double volume); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 428 // SetSendParameters. | 435 // SetSendParameters. |
| 429 AudioSendParameters last_send_params_; | 436 AudioSendParameters last_send_params_; |
| 430 // Last AudioRecvParameters sent down to the media_channel() via | 437 // Last AudioRecvParameters sent down to the media_channel() via |
| 431 // SetRecvParameters. | 438 // SetRecvParameters. |
| 432 AudioRecvParameters last_recv_params_; | 439 AudioRecvParameters last_recv_params_; |
| 433 }; | 440 }; |
| 434 | 441 |
| 435 // VideoChannel is a specialization for video. | 442 // VideoChannel is a specialization for video. |
| 436 class VideoChannel : public BaseChannel { | 443 class VideoChannel : public BaseChannel { |
| 437 public: | 444 public: |
| 438 VideoChannel(rtc::Thread* thread, | 445 VideoChannel(rtc::Thread* worker_thread, |
| 446 rtc::Thread* netwokr_thread, |
| 439 VideoMediaChannel* channel, | 447 VideoMediaChannel* channel, |
| 440 TransportController* transport_controller, | 448 TransportController* transport_controller, |
| 441 const std::string& content_name, | 449 const std::string& content_name, |
| 442 bool rtcp); | 450 bool rtcp); |
| 443 ~VideoChannel(); | 451 ~VideoChannel(); |
| 444 bool Init(); | 452 bool Init(); |
| 445 | 453 |
| 446 // downcasts a MediaChannel | 454 // downcasts a MediaChannel |
| 447 virtual VideoMediaChannel* media_channel() const { | 455 virtual VideoMediaChannel* media_channel() const { |
| 448 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); | 456 return static_cast<VideoMediaChannel*>(BaseChannel::media_channel()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 462 void StartMediaMonitor(int cms); | 470 void StartMediaMonitor(int cms); |
| 463 void StopMediaMonitor(); | 471 void StopMediaMonitor(); |
| 464 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; | 472 sigslot::signal2<VideoChannel*, const VideoMediaInfo&> SignalMediaMonitor; |
| 465 | 473 |
| 466 bool SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options); | 474 bool SetVideoSend(uint32_t ssrc, bool enable, const VideoOptions* options); |
| 467 webrtc::RtpParameters GetRtpParameters(uint32_t ssrc) const; | 475 webrtc::RtpParameters GetRtpParameters(uint32_t ssrc) const; |
| 468 bool SetRtpParameters(uint32_t ssrc, const webrtc::RtpParameters& parameters); | 476 bool SetRtpParameters(uint32_t ssrc, const webrtc::RtpParameters& parameters); |
| 469 | 477 |
| 470 private: | 478 private: |
| 471 // overrides from BaseChannel | 479 // overrides from BaseChannel |
| 472 virtual void ChangeState(); | 480 void ChangeState_w() override; |
| 473 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); | 481 virtual const ContentInfo* GetFirstContent(const SessionDescription* sdesc); |
| 474 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 482 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
| 475 ContentAction action, | 483 ContentAction action, |
| 476 std::string* error_desc); | 484 std::string* error_desc); |
| 477 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 485 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 478 ContentAction action, | 486 ContentAction action, |
| 479 std::string* error_desc); | 487 std::string* error_desc); |
| 480 bool GetStats_w(VideoMediaInfo* stats); | 488 bool GetStats_w(VideoMediaInfo* stats); |
| 481 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; | 489 webrtc::RtpParameters GetRtpParameters_w(uint32_t ssrc) const; |
| 482 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); | 490 bool SetRtpParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 494 // SetSendParameters. | 502 // SetSendParameters. |
| 495 VideoSendParameters last_send_params_; | 503 VideoSendParameters last_send_params_; |
| 496 // Last VideoRecvParameters sent down to the media_channel() via | 504 // Last VideoRecvParameters sent down to the media_channel() via |
| 497 // SetRecvParameters. | 505 // SetRecvParameters. |
| 498 VideoRecvParameters last_recv_params_; | 506 VideoRecvParameters last_recv_params_; |
| 499 }; | 507 }; |
| 500 | 508 |
| 501 // DataChannel is a specialization for data. | 509 // DataChannel is a specialization for data. |
| 502 class DataChannel : public BaseChannel { | 510 class DataChannel : public BaseChannel { |
| 503 public: | 511 public: |
| 504 DataChannel(rtc::Thread* thread, | 512 DataChannel(rtc::Thread* worker_thread, |
| 513 rtc::Thread* network_thread, |
| 505 DataMediaChannel* media_channel, | 514 DataMediaChannel* media_channel, |
| 506 TransportController* transport_controller, | 515 TransportController* transport_controller, |
| 507 const std::string& content_name, | 516 const std::string& content_name, |
| 508 bool rtcp); | 517 bool rtcp); |
| 509 ~DataChannel(); | 518 ~DataChannel(); |
| 510 bool Init(); | 519 bool Init(); |
| 511 | 520 |
| 512 virtual bool SendData(const SendDataParams& params, | 521 virtual bool SendData(const SendDataParams& params, |
| 513 const rtc::CopyOnWriteBuffer& payload, | 522 const rtc::CopyOnWriteBuffer& payload, |
| 514 SendDataResult* result); | 523 SendDataResult* result); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 // Same as SetDataChannelType, but extracts the type from the | 590 // Same as SetDataChannelType, but extracts the type from the |
| 582 // DataContentDescription. | 591 // DataContentDescription. |
| 583 bool SetDataChannelTypeFromContent(const DataContentDescription* content, | 592 bool SetDataChannelTypeFromContent(const DataContentDescription* content, |
| 584 std::string* error_desc); | 593 std::string* error_desc); |
| 585 virtual bool SetLocalContent_w(const MediaContentDescription* content, | 594 virtual bool SetLocalContent_w(const MediaContentDescription* content, |
| 586 ContentAction action, | 595 ContentAction action, |
| 587 std::string* error_desc); | 596 std::string* error_desc); |
| 588 virtual bool SetRemoteContent_w(const MediaContentDescription* content, | 597 virtual bool SetRemoteContent_w(const MediaContentDescription* content, |
| 589 ContentAction action, | 598 ContentAction action, |
| 590 std::string* error_desc); | 599 std::string* error_desc); |
| 591 virtual void ChangeState(); | 600 void ChangeState_w() override; |
| 592 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); | 601 bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet) override; |
| 593 | 602 |
| 594 virtual void OnMessage(rtc::Message* pmsg); | 603 virtual void OnMessage(rtc::Message* pmsg); |
| 595 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; | 604 virtual void GetSrtpCryptoSuites(std::vector<int>* crypto_suites) const; |
| 596 virtual void OnConnectionMonitorUpdate( | 605 virtual void OnConnectionMonitorUpdate( |
| 597 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); | 606 ConnectionMonitor* monitor, const std::vector<ConnectionInfo>& infos); |
| 598 virtual void OnMediaMonitorUpdate( | 607 virtual void OnMediaMonitorUpdate( |
| 599 DataMediaChannel* media_channel, const DataMediaInfo& info); | 608 DataMediaChannel* media_channel, const DataMediaInfo& info); |
| 600 virtual bool ShouldSetupDtlsSrtp() const; | 609 virtual bool ShouldSetupDtlsSrtp() const; |
| 601 void OnDataReceived( | 610 void OnDataReceived( |
| 602 const ReceiveDataParams& params, const char* data, size_t len); | 611 const ReceiveDataParams& params, const char* data, size_t len); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 614 // SetSendParameters. | 623 // SetSendParameters. |
| 615 DataSendParameters last_send_params_; | 624 DataSendParameters last_send_params_; |
| 616 // Last DataRecvParameters sent down to the media_channel() via | 625 // Last DataRecvParameters sent down to the media_channel() via |
| 617 // SetRecvParameters. | 626 // SetRecvParameters. |
| 618 DataRecvParameters last_recv_params_; | 627 DataRecvParameters last_recv_params_; |
| 619 }; | 628 }; |
| 620 | 629 |
| 621 } // namespace cricket | 630 } // namespace cricket |
| 622 | 631 |
| 623 #endif // WEBRTC_PC_CHANNEL_H_ | 632 #endif // WEBRTC_PC_CHANNEL_H_ |
| OLD | NEW |