zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 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 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef PC_RTPTRANSPORTINTERNAL_H_ |
| 12 | #define PC_RTPTRANSPORTINTERNAL_H_ |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 13 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 14 | #include "api/ortc/rtptransportinterface.h" |
| 15 | #include "rtc_base/sigslot.h" |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 16 | |
| 17 | namespace rtc { |
| 18 | class CopyOnWriteBuffer; |
| 19 | struct PacketOptions; |
| 20 | struct PacketTime; |
| 21 | } // namespace rtc |
| 22 | |
| 23 | namespace webrtc { |
| 24 | |
| 25 | // This represents the internal interface beneath RtpTransportInterface; |
| 26 | // it is not accessible to API consumers but is accessible to internal classes |
| 27 | // in order to send and receive RTP and RTCP packets belonging to a single RTP |
| 28 | // session. Additional convenience and configuration methods are also provided. |
| 29 | class RtpTransportInternal : public RtpTransportInterface, |
| 30 | public sigslot::has_slots<> { |
| 31 | public: |
| 32 | virtual void SetRtcpMuxEnabled(bool enable) = 0; |
| 33 | |
| 34 | // TODO(zstein): Remove PacketTransport setters. Clients should pass these |
| 35 | // in to constructors instead and construct a new RtpTransportInternal instead |
| 36 | // of updating them. |
| 37 | |
| 38 | virtual rtc::PacketTransportInternal* rtp_packet_transport() const = 0; |
| 39 | virtual void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp) = 0; |
| 40 | |
| 41 | virtual rtc::PacketTransportInternal* rtcp_packet_transport() const = 0; |
| 42 | virtual void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) = 0; |
| 43 | |
| 44 | // Called whenever a transport's ready-to-send state changes. The argument |
| 45 | // is true if all used transports are ready to send. This is more specific |
| 46 | // than just "writable"; it means the last send didn't return ENOTCONN. |
| 47 | sigslot::signal1<bool> SignalReadyToSend; |
| 48 | |
| 49 | // TODO(zstein): Consider having two signals - RtpPacketReceived and |
| 50 | // RtcpPacketReceived. |
| 51 | // The first argument is true for RTCP packets and false for RTP packets. |
| 52 | sigslot::signal3<bool, rtc::CopyOnWriteBuffer*, const rtc::PacketTime&> |
| 53 | SignalPacketReceived; |
| 54 | |
| 55 | virtual bool IsWritable(bool rtcp) const = 0; |
| 56 | |
Zhi Huang | cf990f5 | 2017-09-22 12:12:30 -0700 | [diff] [blame] | 57 | virtual bool SendRtpPacket(rtc::CopyOnWriteBuffer* packet, |
| 58 | const rtc::PacketOptions& options, |
| 59 | int flags) = 0; |
| 60 | |
| 61 | virtual bool SendRtcpPacket(rtc::CopyOnWriteBuffer* packet, |
| 62 | const rtc::PacketOptions& options, |
| 63 | int flags) = 0; |
zstein | 398c3fd | 2017-07-19 13:38:02 -0700 | [diff] [blame] | 64 | |
| 65 | virtual bool HandlesPayloadType(int payload_type) const = 0; |
| 66 | |
| 67 | virtual void AddHandledPayloadType(int payload_type) = 0; |
| 68 | }; |
| 69 | |
| 70 | } // namespace webrtc |
| 71 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 72 | #endif // PC_RTPTRANSPORTINTERNAL_H_ |