OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ |
| 12 #define WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ |
| 13 |
| 14 #include <string> |
| 15 |
| 16 #include "webrtc/api/ortc/packettransportinterface.h" |
| 17 #include "webrtc/api/rtcerror.h" |
| 18 #include "webrtc/base/optional.h" |
| 19 |
| 20 namespace webrtc { |
| 21 |
| 22 class RtpTransportAdapter; |
| 23 |
| 24 struct RtcpParameters { |
| 25 // The SSRC to be used in the "SSRC of packet sender" field. |
| 26 // If not set, one will be chosen by the implementation. |
| 27 // TODO(deadbeef): Not implemented. |
| 28 rtc::Optional<uint32_t> ssrc; |
| 29 |
| 30 // RTCP CNAME; if empty in the construction of the RtpTransport, one will be |
| 31 // chosen by the implementation, and returned in GetRtcpParameters. |
| 32 // |
| 33 // If empty when passed into SetRtcpParameters, the CNAME simply won't be |
| 34 // modified. |
| 35 std::string cname; |
| 36 |
| 37 // Send reduced-size RTCP? |
| 38 bool reduced_size = false; |
| 39 |
| 40 // Send RTCP multiplexed on the RTP transport? |
| 41 bool mux = true; |
| 42 |
| 43 bool operator==(const RtcpParameters& o) const { |
| 44 return ssrc == o.ssrc && cname == o.cname && |
| 45 reduced_size == o.reduced_size && mux == o.mux; |
| 46 } |
| 47 bool operator!=(const RtcpParameters& o) const { return !(*this == o); } |
| 48 }; |
| 49 |
| 50 // Base class for different types of RTP transports that can be created by an |
| 51 // OrtcFactory. Used by RtpSender/RtpReceivers. |
| 52 class RtpTransportInterface { |
| 53 public: |
| 54 virtual ~RtpTransportInterface() {} |
| 55 |
| 56 // Returns packet transport that's used to send RTP packets. |
| 57 virtual PacketTransportInterface* GetRtpPacketTransport() const = 0; |
| 58 |
| 59 // Returns separate packet transport that's used to send RTCP packets. |
| 60 // If RTCP multiplexing is being used, returns nullptr. |
| 61 virtual PacketTransportInterface* GetRtcpPacketTransport() const = 0; |
| 62 |
| 63 // Set/get RTCP params. Changing |mux| from "true" to "false" is not allowed, |
| 64 // and changing the CNAME is currently unsupported. So this is expected to be |
| 65 // used to enable RTCP muxing or reduced-size RTCP if initially not enabled. |
| 66 virtual RTCError SetRtcpParameters(const RtcpParameters& parameters) = 0; |
| 67 virtual RtcpParameters GetRtcpParameters() const = 0; |
| 68 |
| 69 protected: |
| 70 // Only for internal use. |
| 71 // Returns a pointer to the internal (non-public) interface. |
| 72 virtual RtpTransportAdapter* GetInternal() = 0; |
| 73 |
| 74 // Classes that can use this internal interface. |
| 75 friend class OrtcFactory; |
| 76 friend class OrtcRtpSenderAdapter; |
| 77 friend class OrtcRtpReceiverAdapter; |
| 78 friend class RtpTransportControllerAdapter; |
| 79 friend class RtpTransportAdapter; |
| 80 }; |
| 81 |
| 82 } // namespace webrtc |
| 83 |
| 84 #endif // WEBRTC_API_ORTC_RTPTRANSPORTINTERFACE_H_ |
OLD | NEW |