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

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

Issue 2890263003: Move RTP/RTCP demuxing logic from BaseChannel to RtpTransport. (Closed)
Patch Set: Move more demuxing logic from BaseChannel to RtpTransport. Created 3 years, 7 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 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 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
11 #ifndef WEBRTC_PC_RTPTRANSPORT_H_ 11 #ifndef WEBRTC_PC_RTPTRANSPORT_H_
12 #define WEBRTC_PC_RTPTRANSPORT_H_ 12 #define WEBRTC_PC_RTPTRANSPORT_H_
13 13
14 #include "webrtc/api/ortc/rtptransportinterface.h" 14 #include "webrtc/api/ortc/rtptransportinterface.h"
15 #include "webrtc/base/sigslot.h" 15 #include "webrtc/base/sigslot.h"
16 #include "webrtc/pc/bundlefilter.h"
16 17
17 namespace rtc { 18 namespace rtc {
18 19
19 class CopyOnWriteBuffer; 20 class CopyOnWriteBuffer;
20 struct PacketOptions; 21 struct PacketOptions;
22 struct PacketTime;
21 class PacketTransportInternal; 23 class PacketTransportInternal;
22 24
23 } // namespace rtc 25 } // namespace rtc
24 26
25 namespace webrtc { 27 namespace webrtc {
26 28
27 class RtpTransport : public RtpTransportInterface, public sigslot::has_slots<> { 29 class RtpTransport : public RtpTransportInterface, public sigslot::has_slots<> {
28 public: 30 public:
29 RtpTransport(const RtpTransport&) = delete; 31 RtpTransport(const RtpTransport&) = delete;
30 RtpTransport& operator=(const RtpTransport&) = delete; 32 RtpTransport& operator=(const RtpTransport&) = delete;
(...skipping 26 matching lines...) Expand all
57 // than just "writable"; it means the last send didn't return ENOTCONN. 59 // than just "writable"; it means the last send didn't return ENOTCONN.
58 sigslot::signal1<bool> SignalReadyToSend; 60 sigslot::signal1<bool> SignalReadyToSend;
59 61
60 bool IsWritable(bool rtcp) const; 62 bool IsWritable(bool rtcp) const;
61 63
62 bool SendPacket(bool rtcp, 64 bool SendPacket(bool rtcp,
63 const rtc::CopyOnWriteBuffer* packet, 65 const rtc::CopyOnWriteBuffer* packet,
64 const rtc::PacketOptions& options, 66 const rtc::PacketOptions& options,
65 int flags); 67 int flags);
66 68
69 bool HandlesPayloadType(int payload_type) const;
70
71 void AddHandledPayloadType(int payload_type);
72
73 bool received_media() const { return received_media_; }
74
75 sigslot::signal0<> SignalFirstPacketReceived;
76
77 sigslot::signal3<bool, rtc::CopyOnWriteBuffer&, const rtc::PacketTime&>
78 SignalPacketReceived;
79
67 protected: 80 protected:
68 // TODO(zstein): Remove this when we remove RtpTransportAdapter. 81 // TODO(zstein): Remove this when we remove RtpTransportAdapter.
69 RtpTransportAdapter* GetInternal() override; 82 RtpTransportAdapter* GetInternal() override;
70 83
71 private: 84 private:
85 bool HandlesPacket(const uint8_t* data, size_t len);
86
72 void OnReadyToSend(rtc::PacketTransportInternal* transport); 87 void OnReadyToSend(rtc::PacketTransportInternal* transport);
73 88
74 // Updates "ready to send" for an individual channel and fires 89 // Updates "ready to send" for an individual channel and fires
75 // SignalReadyToSend. 90 // SignalReadyToSend.
76 void SetReadyToSend(bool rtcp, bool ready); 91 void SetReadyToSend(bool rtcp, bool ready);
77 92
78 void MaybeSignalReadyToSend(); 93 void MaybeSignalReadyToSend();
79 94
95 void OnReadPacket(rtc::PacketTransportInternal* transport,
96 const char* data,
97 size_t len,
98 const rtc::PacketTime& packet_time,
99 int flags);
100
101 bool PacketIsRtcp(const rtc::PacketTransportInternal* transport,
102 const char* data,
103 size_t len);
104
105 bool WantsPacket(bool rtcp, const rtc::CopyOnWriteBuffer* packet);
106
80 bool rtcp_mux_enabled_; 107 bool rtcp_mux_enabled_;
81 108
82 rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr; 109 rtc::PacketTransportInternal* rtp_packet_transport_ = nullptr;
83 rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr; 110 rtc::PacketTransportInternal* rtcp_packet_transport_ = nullptr;
84 111
85 bool ready_to_send_ = false; 112 bool ready_to_send_ = false;
86 bool rtp_ready_to_send_ = false; 113 bool rtp_ready_to_send_ = false;
87 bool rtcp_ready_to_send_ = false; 114 bool rtcp_ready_to_send_ = false;
88 115
89 RtcpParameters rtcp_parameters_; 116 RtcpParameters rtcp_parameters_;
117
118 cricket::BundleFilter bundle_filter_;
119
120 bool has_received_packet_ = false;
121 bool received_media_ = false;
90 }; 122 };
91 123
92 } // namespace webrtc 124 } // namespace webrtc
93 125
94 #endif // WEBRTC_PC_RTPTRANSPORT_H_ 126 #endif // WEBRTC_PC_RTPTRANSPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698