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 21 matching lines...) Expand all Loading... |
32 #include "webrtc/media/base/videosourceinterface.h" | 32 #include "webrtc/media/base/videosourceinterface.h" |
33 #include "webrtc/p2p/base/transportcontroller.h" | 33 #include "webrtc/p2p/base/transportcontroller.h" |
34 #include "webrtc/p2p/client/socketmonitor.h" | 34 #include "webrtc/p2p/client/socketmonitor.h" |
35 #include "webrtc/pc/audiomonitor.h" | 35 #include "webrtc/pc/audiomonitor.h" |
36 #include "webrtc/pc/bundlefilter.h" | 36 #include "webrtc/pc/bundlefilter.h" |
37 #include "webrtc/pc/mediamonitor.h" | 37 #include "webrtc/pc/mediamonitor.h" |
38 #include "webrtc/pc/mediasession.h" | 38 #include "webrtc/pc/mediasession.h" |
39 #include "webrtc/pc/rtcpmuxfilter.h" | 39 #include "webrtc/pc/rtcpmuxfilter.h" |
40 #include "webrtc/pc/srtpfilter.h" | 40 #include "webrtc/pc/srtpfilter.h" |
41 | 41 |
| 42 namespace rtc { |
| 43 class PacketTransportInterface; |
| 44 } |
| 45 |
42 namespace webrtc { | 46 namespace webrtc { |
43 class AudioSinkInterface; | 47 class AudioSinkInterface; |
44 } // namespace webrtc | 48 } // namespace webrtc |
45 | 49 |
46 namespace cricket { | 50 namespace cricket { |
47 | 51 |
48 struct CryptoParams; | 52 struct CryptoParams; |
49 class MediaContentDescription; | 53 class MediaContentDescription; |
50 | 54 |
51 // BaseChannel contains logic common to voice and video, including enable, | 55 // BaseChannel contains logic common to voice and video, including enable, |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 230 |
227 void FlushRtcpMessages_n(); | 231 void FlushRtcpMessages_n(); |
228 | 232 |
229 // NetworkInterface implementation, called by MediaEngine | 233 // NetworkInterface implementation, called by MediaEngine |
230 bool SendPacket(rtc::CopyOnWriteBuffer* packet, | 234 bool SendPacket(rtc::CopyOnWriteBuffer* packet, |
231 const rtc::PacketOptions& options) override; | 235 const rtc::PacketOptions& options) override; |
232 bool SendRtcp(rtc::CopyOnWriteBuffer* packet, | 236 bool SendRtcp(rtc::CopyOnWriteBuffer* packet, |
233 const rtc::PacketOptions& options) override; | 237 const rtc::PacketOptions& options) override; |
234 | 238 |
235 // From TransportChannel | 239 // From TransportChannel |
236 void OnWritableState(TransportChannel* channel); | 240 void OnWritableState(rtc::PacketTransportInterface* transport); |
237 virtual void OnChannelRead(TransportChannel* channel, | 241 virtual void OnPacketRead(rtc::PacketTransportInterface* transport, |
238 const char* data, | 242 const char* data, |
239 size_t len, | 243 size_t len, |
240 const rtc::PacketTime& packet_time, | 244 const rtc::PacketTime& packet_time, |
241 int flags); | 245 int flags); |
242 void OnReadyToSend(TransportChannel* channel); | 246 void OnReadyToSend(rtc::PacketTransportInterface* transport); |
243 | 247 |
244 void OnDtlsState(TransportChannel* channel, DtlsTransportState state); | 248 void OnDtlsState(TransportChannel* channel, DtlsTransportState state); |
245 | 249 |
246 void OnSelectedCandidatePairChanged( | 250 void OnSelectedCandidatePairChanged( |
247 TransportChannel* channel, | 251 TransportChannel* channel, |
248 CandidatePairInterface* selected_candidate_pair, | 252 CandidatePairInterface* selected_candidate_pair, |
249 int last_sent_packet_id, | 253 int last_sent_packet_id, |
250 bool ready_to_send); | 254 bool ready_to_send); |
251 | 255 |
252 bool PacketIsRtcp(const TransportChannel* channel, const char* data, | 256 bool PacketIsRtcp(const rtc::PacketTransportInterface* transport, |
| 257 const char* data, |
253 size_t len); | 258 size_t len); |
254 bool SendPacket(bool rtcp, | 259 bool SendPacket(bool rtcp, |
255 rtc::CopyOnWriteBuffer* packet, | 260 rtc::CopyOnWriteBuffer* packet, |
256 const rtc::PacketOptions& options); | 261 const rtc::PacketOptions& options); |
257 | 262 |
258 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); | 263 virtual bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet); |
259 void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, | 264 void HandlePacket(bool rtcp, rtc::CopyOnWriteBuffer* packet, |
260 const rtc::PacketTime& packet_time); | 265 const rtc::PacketTime& packet_time); |
261 void OnPacketReceived(bool rtcp, | 266 void OnPacketReceived(bool rtcp, |
262 const rtc::CopyOnWriteBuffer& packet, | 267 const rtc::CopyOnWriteBuffer& packet, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 template <class FunctorT> | 354 template <class FunctorT> |
350 bool InvokeOnWorker(const rtc::Location& posted_from, | 355 bool InvokeOnWorker(const rtc::Location& posted_from, |
351 const FunctorT& functor) { | 356 const FunctorT& functor) { |
352 return worker_thread_->Invoke<bool>(posted_from, functor); | 357 return worker_thread_->Invoke<bool>(posted_from, functor); |
353 } | 358 } |
354 | 359 |
355 private: | 360 private: |
356 bool InitNetwork_n(const std::string* bundle_transport_name); | 361 bool InitNetwork_n(const std::string* bundle_transport_name); |
357 void DisconnectTransportChannels_n(); | 362 void DisconnectTransportChannels_n(); |
358 void DestroyTransportChannels_n(); | 363 void DestroyTransportChannels_n(); |
359 void SignalSentPacket_n(TransportChannel* channel, | 364 void SignalSentPacket_n(rtc::PacketTransportInterface* transport, |
360 const rtc::SentPacket& sent_packet); | 365 const rtc::SentPacket& sent_packet); |
361 void SignalSentPacket_w(const rtc::SentPacket& sent_packet); | 366 void SignalSentPacket_w(const rtc::SentPacket& sent_packet); |
362 bool IsReadyToSendMedia_n() const; | 367 bool IsReadyToSendMedia_n() const; |
363 void CacheRtpAbsSendTimeHeaderExtension_n(int rtp_abs_sendtime_extn_id); | 368 void CacheRtpAbsSendTimeHeaderExtension_n(int rtp_abs_sendtime_extn_id); |
364 | 369 |
365 rtc::Thread* const worker_thread_; | 370 rtc::Thread* const worker_thread_; |
366 rtc::Thread* const network_thread_; | 371 rtc::Thread* const network_thread_; |
367 rtc::AsyncInvoker invoker_; | 372 rtc::AsyncInvoker invoker_; |
368 | 373 |
369 const std::string content_name_; | 374 const std::string content_name_; |
370 std::unique_ptr<ConnectionMonitor> connection_monitor_; | 375 std::unique_ptr<ConnectionMonitor> connection_monitor_; |
371 | 376 |
372 // Transport related members that should be accessed from network thread. | 377 // Transport related members that should be accessed from network thread. |
373 TransportController* const transport_controller_; | 378 TransportController* const transport_controller_; |
374 std::string transport_name_; | 379 std::string transport_name_; |
375 // Is RTCP used at all by this type of channel? | 380 // Is RTCP used at all by this type of channel? |
376 // Expected to be true (as of typing this) for everything except data | 381 // Expected to be true (as of typing this) for everything except data |
377 // channels. | 382 // channels. |
378 const bool rtcp_enabled_; | 383 const bool rtcp_enabled_; |
| 384 // TODO(johan): Replace TransportChannel* with rtc::PacketTransportInterface*. |
379 TransportChannel* transport_channel_ = nullptr; | 385 TransportChannel* transport_channel_ = nullptr; |
380 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; | 386 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; |
381 TransportChannel* rtcp_transport_channel_ = nullptr; | 387 TransportChannel* rtcp_transport_channel_ = nullptr; |
382 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; | 388 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; |
383 SrtpFilter srtp_filter_; | 389 SrtpFilter srtp_filter_; |
384 RtcpMuxFilter rtcp_mux_filter_; | 390 RtcpMuxFilter rtcp_mux_filter_; |
385 BundleFilter bundle_filter_; | 391 BundleFilter bundle_filter_; |
386 bool rtp_ready_to_send_ = false; | 392 bool rtp_ready_to_send_ = false; |
387 bool rtcp_ready_to_send_ = false; | 393 bool rtcp_ready_to_send_ = false; |
388 bool writable_ = false; | 394 bool writable_ = false; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 void GetActiveStreams_w(AudioInfo::StreamList* actives); | 483 void GetActiveStreams_w(AudioInfo::StreamList* actives); |
478 webrtc::RtpParameters GetRtpSendParameters_w(uint32_t ssrc) const; | 484 webrtc::RtpParameters GetRtpSendParameters_w(uint32_t ssrc) const; |
479 bool SetRtpSendParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); | 485 bool SetRtpSendParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); |
480 webrtc::RtpParameters GetRtpReceiveParameters_w(uint32_t ssrc) const; | 486 webrtc::RtpParameters GetRtpReceiveParameters_w(uint32_t ssrc) const; |
481 bool SetRtpReceiveParameters_w(uint32_t ssrc, | 487 bool SetRtpReceiveParameters_w(uint32_t ssrc, |
482 webrtc::RtpParameters parameters); | 488 webrtc::RtpParameters parameters); |
483 cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_AUDIO; } | 489 cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_AUDIO; } |
484 | 490 |
485 private: | 491 private: |
486 // overrides from BaseChannel | 492 // overrides from BaseChannel |
487 void OnChannelRead(TransportChannel* channel, | 493 void OnPacketRead(rtc::PacketTransportInterface* transport, |
488 const char* data, | 494 const char* data, |
489 size_t len, | 495 size_t len, |
490 const rtc::PacketTime& packet_time, | 496 const rtc::PacketTime& packet_time, |
491 int flags) override; | 497 int flags) override; |
492 void UpdateMediaSendRecvState_w() override; | 498 void UpdateMediaSendRecvState_w() override; |
493 const ContentInfo* GetFirstContent(const SessionDescription* sdesc) override; | 499 const ContentInfo* GetFirstContent(const SessionDescription* sdesc) override; |
494 bool SetLocalContent_w(const MediaContentDescription* content, | 500 bool SetLocalContent_w(const MediaContentDescription* content, |
495 ContentAction action, | 501 ContentAction action, |
496 std::string* error_desc) override; | 502 std::string* error_desc) override; |
497 bool SetRemoteContent_w(const MediaContentDescription* content, | 503 bool SetRemoteContent_w(const MediaContentDescription* content, |
498 ContentAction action, | 504 ContentAction action, |
499 std::string* error_desc) override; | 505 std::string* error_desc) override; |
500 void HandleEarlyMediaTimeout(); | 506 void HandleEarlyMediaTimeout(); |
501 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); | 507 bool InsertDtmf_w(uint32_t ssrc, int event, int duration); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 // SetSendParameters. | 727 // SetSendParameters. |
722 DataSendParameters last_send_params_; | 728 DataSendParameters last_send_params_; |
723 // Last DataRecvParameters sent down to the media_channel() via | 729 // Last DataRecvParameters sent down to the media_channel() via |
724 // SetRecvParameters. | 730 // SetRecvParameters. |
725 DataRecvParameters last_recv_params_; | 731 DataRecvParameters last_recv_params_; |
726 }; | 732 }; |
727 | 733 |
728 } // namespace cricket | 734 } // namespace cricket |
729 | 735 |
730 #endif // WEBRTC_PC_CHANNEL_H_ | 736 #endif // WEBRTC_PC_CHANNEL_H_ |
OLD | NEW |