Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1518)

Side by Side Diff: webrtc/pc/channel.h

Issue 2416023002: Introduce rtc::PacketTransportInterface and let cricket::TransportChannel inherit. (Closed)
Patch Set: Resolve unused variable issue in release build. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 struct PacketTransport;
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
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::PacketTransport* pt);
237 virtual void OnChannelRead(TransportChannel* channel, 241 virtual void OnChannelRead(rtc::PacketTransport* pt,
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);
pthatcher1 2016/10/13 20:26:38 OnChannelRead should probably be renamed to OnPack
johan 2016/10/14 16:09:33 Acknowledged.
242 void OnReadyToSend(TransportChannel* channel); 246 void OnReadyToSend(rtc::PacketTransport* pt);
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 TransportChannel* channel, const char* data,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 template <class FunctorT> 353 template <class FunctorT>
350 bool InvokeOnWorker(const rtc::Location& posted_from, 354 bool InvokeOnWorker(const rtc::Location& posted_from,
351 const FunctorT& functor) { 355 const FunctorT& functor) {
352 return worker_thread_->Invoke<bool>(posted_from, functor); 356 return worker_thread_->Invoke<bool>(posted_from, functor);
353 } 357 }
354 358
355 private: 359 private:
356 bool InitNetwork_n(const std::string* bundle_transport_name); 360 bool InitNetwork_n(const std::string* bundle_transport_name);
357 void DisconnectTransportChannels_n(); 361 void DisconnectTransportChannels_n();
358 void DestroyTransportChannels_n(); 362 void DestroyTransportChannels_n();
359 void SignalSentPacket_n(TransportChannel* channel, 363 void SignalSentPacket_n(rtc::PacketTransport* pt,
360 const rtc::SentPacket& sent_packet); 364 const rtc::SentPacket& sent_packet);
361 void SignalSentPacket_w(const rtc::SentPacket& sent_packet); 365 void SignalSentPacket_w(const rtc::SentPacket& sent_packet);
362 bool IsReadyToSendMedia_n() const; 366 bool IsReadyToSendMedia_n() const;
363 void CacheRtpAbsSendTimeHeaderExtension_n(int rtp_abs_sendtime_extn_id); 367 void CacheRtpAbsSendTimeHeaderExtension_n(int rtp_abs_sendtime_extn_id);
364 368
365 rtc::Thread* const worker_thread_; 369 rtc::Thread* const worker_thread_;
366 rtc::Thread* const network_thread_; 370 rtc::Thread* const network_thread_;
367 rtc::AsyncInvoker invoker_; 371 rtc::AsyncInvoker invoker_;
368 372
369 const std::string content_name_; 373 const std::string content_name_;
370 std::unique_ptr<ConnectionMonitor> connection_monitor_; 374 std::unique_ptr<ConnectionMonitor> connection_monitor_;
371 375
372 // Transport related members that should be accessed from network thread. 376 // Transport related members that should be accessed from network thread.
373 TransportController* const transport_controller_; 377 TransportController* const transport_controller_;
374 std::string transport_name_; 378 std::string transport_name_;
375 // Is RTCP used at all by this type of channel? 379 // Is RTCP used at all by this type of channel?
376 // Expected to be true (as of typing this) for everything except data 380 // Expected to be true (as of typing this) for everything except data
377 // channels. 381 // channels.
378 const bool rtcp_enabled_; 382 const bool rtcp_enabled_;
383 // TODO(johan): replace TransportChannel* by rtc::PacketTransport*.
379 TransportChannel* transport_channel_ = nullptr; 384 TransportChannel* transport_channel_ = nullptr;
380 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_; 385 std::vector<std::pair<rtc::Socket::Option, int> > socket_options_;
381 TransportChannel* rtcp_transport_channel_ = nullptr; 386 TransportChannel* rtcp_transport_channel_ = nullptr;
382 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_; 387 std::vector<std::pair<rtc::Socket::Option, int> > rtcp_socket_options_;
383 SrtpFilter srtp_filter_; 388 SrtpFilter srtp_filter_;
384 RtcpMuxFilter rtcp_mux_filter_; 389 RtcpMuxFilter rtcp_mux_filter_;
385 BundleFilter bundle_filter_; 390 BundleFilter bundle_filter_;
386 bool rtp_ready_to_send_ = false; 391 bool rtp_ready_to_send_ = false;
387 bool rtcp_ready_to_send_ = false; 392 bool rtcp_ready_to_send_ = false;
388 bool writable_ = false; 393 bool writable_ = false;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 void GetActiveStreams_w(AudioInfo::StreamList* actives); 482 void GetActiveStreams_w(AudioInfo::StreamList* actives);
478 webrtc::RtpParameters GetRtpSendParameters_w(uint32_t ssrc) const; 483 webrtc::RtpParameters GetRtpSendParameters_w(uint32_t ssrc) const;
479 bool SetRtpSendParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters); 484 bool SetRtpSendParameters_w(uint32_t ssrc, webrtc::RtpParameters parameters);
480 webrtc::RtpParameters GetRtpReceiveParameters_w(uint32_t ssrc) const; 485 webrtc::RtpParameters GetRtpReceiveParameters_w(uint32_t ssrc) const;
481 bool SetRtpReceiveParameters_w(uint32_t ssrc, 486 bool SetRtpReceiveParameters_w(uint32_t ssrc,
482 webrtc::RtpParameters parameters); 487 webrtc::RtpParameters parameters);
483 cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_AUDIO; } 488 cricket::MediaType media_type() override { return cricket::MEDIA_TYPE_AUDIO; }
484 489
485 private: 490 private:
486 // overrides from BaseChannel 491 // overrides from BaseChannel
487 void OnChannelRead(TransportChannel* channel, 492 void OnChannelRead(rtc::PacketTransport* pt,
488 const char* data, 493 const char* data,
489 size_t len, 494 size_t len,
490 const rtc::PacketTime& packet_time, 495 const rtc::PacketTime& packet_time,
491 int flags) override; 496 int flags) override;
492 void UpdateMediaSendRecvState_w() override; 497 void UpdateMediaSendRecvState_w() override;
493 const ContentInfo* GetFirstContent(const SessionDescription* sdesc) override; 498 const ContentInfo* GetFirstContent(const SessionDescription* sdesc) override;
494 bool SetLocalContent_w(const MediaContentDescription* content, 499 bool SetLocalContent_w(const MediaContentDescription* content,
495 ContentAction action, 500 ContentAction action,
496 std::string* error_desc) override; 501 std::string* error_desc) override;
497 bool SetRemoteContent_w(const MediaContentDescription* content, 502 bool SetRemoteContent_w(const MediaContentDescription* content,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // SetSendParameters. 726 // SetSendParameters.
722 DataSendParameters last_send_params_; 727 DataSendParameters last_send_params_;
723 // Last DataRecvParameters sent down to the media_channel() via 728 // Last DataRecvParameters sent down to the media_channel() via
724 // SetRecvParameters. 729 // SetRecvParameters.
725 DataRecvParameters last_recv_params_; 730 DataRecvParameters last_recv_params_;
726 }; 731 };
727 732
728 } // namespace cricket 733 } // namespace cricket
729 734
730 #endif // WEBRTC_PC_CHANNEL_H_ 735 #endif // WEBRTC_PC_CHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698