OLD | NEW |
---|---|
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_API_ORTC_RTPTRANSPORTINTERFACE_H_ | 11 #ifndef WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ |
12 #define WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ | 12 #define WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 | 15 |
16 #include "webrtc/api/ortc/packettransportinterface.h" | 16 #include "webrtc/api/ortc/packettransportinterface.h" |
17 #include "webrtc/api/rtcerror.h" | 17 #include "webrtc/api/rtcerror.h" |
18 #include "webrtc/common_types.h" | |
18 #include "webrtc/rtc_base/optional.h" | 19 #include "webrtc/rtc_base/optional.h" |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 | 22 |
22 class RtpTransportAdapter; | 23 class RtpTransportAdapter; |
23 | 24 |
24 struct RtcpParameters { | 25 struct RtcpParameters final { |
25 // The SSRC to be used in the "SSRC of packet sender" field. If not set, one | 26 // The SSRC to be used in the "SSRC of packet sender" field. If not set, one |
26 // will be chosen by the implementation. | 27 // will be chosen by the implementation. |
27 // TODO(deadbeef): Not implemented. | 28 // TODO(deadbeef): Not implemented. |
28 rtc::Optional<uint32_t> ssrc; | 29 rtc::Optional<uint32_t> ssrc; |
29 | 30 |
30 // The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages). | 31 // The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages). |
31 // | 32 // |
32 // If empty in the construction of the RtpTransport, one will be generated by | 33 // If empty in the construction of the RtpTransport, one will be generated by |
33 // the implementation, and returned in GetRtcpParameters. Multiple | 34 // the implementation, and returned in GetRtcpParameters. Multiple |
34 // RtpTransports created by the same OrtcFactory will use the same generated | 35 // RtpTransports created by the same OrtcFactory will use the same generated |
35 // CNAME. | 36 // CNAME. |
36 // | 37 // |
37 // If empty when passed into SetRtcpParameters, the CNAME simply won't be | 38 // If empty when passed into SetRtcpParameters, the CNAME simply won't be |
38 // modified. | 39 // modified. |
39 std::string cname; | 40 std::string cname; |
40 | 41 |
41 // Send reduced-size RTCP? | 42 // Send reduced-size RTCP? |
42 bool reduced_size = false; | 43 bool reduced_size = false; |
43 | 44 |
44 // Send RTCP multiplexed on the RTP transport? | 45 // Send RTCP multiplexed on the RTP transport? |
45 bool mux = true; | 46 bool mux = true; |
46 | 47 |
47 bool operator==(const RtcpParameters& o) const { | 48 bool operator==(const RtcpParameters& o) const { |
48 return ssrc == o.ssrc && cname == o.cname && | 49 return ssrc == o.ssrc && cname == o.cname && |
49 reduced_size == o.reduced_size && mux == o.mux; | 50 reduced_size == o.reduced_size && mux == o.mux; |
50 } | 51 } |
51 bool operator!=(const RtcpParameters& o) const { return !(*this == o); } | 52 bool operator!=(const RtcpParameters& o) const { return !(*this == o); } |
52 }; | 53 }; |
53 | 54 |
55 struct RtpTransportParameters final { | |
56 // Enabled periodic sending of keep-alive packets, that help prevent timeouts | |
57 // on the network level, such as NAT bindings. See RFC6263 section 4.6. | |
58 RtpKeepAliveConfig keepalive_config; | |
pthatcher1
2017/07/11 18:25:09
Can we just call this "keepalive" (or keep_alive?)
sprang_webrtc
2017/07/11 19:54:05
Sure.
| |
59 | |
60 bool operator==(const RtpTransportParameters& o) const { | |
61 return keepalive_config == o.keepalive_config; | |
62 } | |
63 bool operator!=(const RtpTransportParameters& o) const { | |
64 return !(*this == o); | |
65 } | |
66 }; | |
67 | |
54 // Base class for different types of RTP transports that can be created by an | 68 // Base class for different types of RTP transports that can be created by an |
55 // OrtcFactory. Used by RtpSenders/RtpReceivers. | 69 // OrtcFactory. Used by RtpSenders/RtpReceivers. |
56 // | 70 // |
57 // This is not present in the standard ORTC API, but exists here for a few | 71 // This is not present in the standard ORTC API, but exists here for a few |
58 // reasons. Firstly, it allows different types of RTP transports to be used: | 72 // reasons. Firstly, it allows different types of RTP transports to be used: |
59 // DTLS-SRTP (which is required for the web), but also SDES-SRTP and | 73 // DTLS-SRTP (which is required for the web), but also SDES-SRTP and |
60 // unencrypted RTP. It also simplifies the handling of RTCP muxing, and | 74 // unencrypted RTP. It also simplifies the handling of RTCP muxing, and |
61 // provides a better API point for it. | 75 // provides a better API point for it. |
62 // | 76 // |
63 // Note that Edge's implementation of ORTC provides a similar API point, called | 77 // Note that Edge's implementation of ORTC provides a similar API point, called |
(...skipping 14 matching lines...) Expand all Loading... | |
78 // RTCP if initially not enabled. | 92 // RTCP if initially not enabled. |
79 // | 93 // |
80 // Changing |mux| from "true" to "false" is not allowed, and changing the | 94 // Changing |mux| from "true" to "false" is not allowed, and changing the |
81 // CNAME is currently unsupported. | 95 // CNAME is currently unsupported. |
82 virtual RTCError SetRtcpParameters(const RtcpParameters& parameters) = 0; | 96 virtual RTCError SetRtcpParameters(const RtcpParameters& parameters) = 0; |
83 // Returns last set or constructed-with parameters. If |cname| was empty in | 97 // Returns last set or constructed-with parameters. If |cname| was empty in |
84 // construction, the generated CNAME will be present in the returned | 98 // construction, the generated CNAME will be present in the returned |
85 // parameters (see above). | 99 // parameters (see above). |
86 virtual RtcpParameters GetRtcpParameters() const = 0; | 100 virtual RtcpParameters GetRtcpParameters() const = 0; |
87 | 101 |
102 virtual RTCError SetRtpTransportParameters( | |
103 const RtpTransportParameters& parameters) = 0; | |
104 virtual RtpTransportParameters GetRtpTransportParameters() const = 0; | |
pthatcher1
2017/07/11 18:25:09
I think we should merge these into one set of get/
sprang_webrtc
2017/07/11 19:54:05
I pondered that, but then we're mixing a transport
pthatcher1
2017/07/12 22:45:21
Ah, that's a good point. I was thrown off by the
Taylor Brandstetter
2017/07/12 23:15:50
Wait, what feature here is stream-level? The keepa
| |
105 | |
88 protected: | 106 protected: |
89 // Only for internal use. Returns a pointer to an internal interface, for use | 107 // Only for internal use. Returns a pointer to an internal interface, for use |
90 // by the implementation. | 108 // by the implementation. |
91 virtual RtpTransportAdapter* GetInternal() = 0; | 109 virtual RtpTransportAdapter* GetInternal() = 0; |
92 | 110 |
93 // Classes that can use this internal interface. | 111 // Classes that can use this internal interface. |
94 friend class OrtcFactory; | 112 friend class OrtcFactory; |
95 friend class OrtcRtpSenderAdapter; | 113 friend class OrtcRtpSenderAdapter; |
96 friend class OrtcRtpReceiverAdapter; | 114 friend class OrtcRtpReceiverAdapter; |
97 friend class RtpTransportControllerAdapter; | 115 friend class RtpTransportControllerAdapter; |
98 friend class RtpTransportAdapter; | 116 friend class RtpTransportAdapter; |
99 }; | 117 }; |
100 | 118 |
101 } // namespace webrtc | 119 } // namespace webrtc |
102 | 120 |
103 #endif // WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ | 121 #endif // WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ |
OLD | NEW |