blob: e58961997bcc4377cdd0730c3e6d0caa1f3679c5 [file] [log] [blame]
zstein398c3fd2017-07-19 13:38:02 -07001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef PC_RTPTRANSPORTINTERNAL_H_
12#define PC_RTPTRANSPORTINTERNAL_H_
zstein398c3fd2017-07-19 13:38:02 -070013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "api/ortc/rtptransportinterface.h"
15#include "rtc_base/sigslot.h"
zstein398c3fd2017-07-19 13:38:02 -070016
17namespace rtc {
18class CopyOnWriteBuffer;
19struct PacketOptions;
20struct PacketTime;
21} // namespace rtc
22
23namespace 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.
29class 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 Huangcf990f52017-09-22 12:12:30 -070057 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;
zstein398c3fd2017-07-19 13:38:02 -070064
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 Bonadei92ea95e2017-09-15 06:47:31 +020072#endif // PC_RTPTRANSPORTINTERNAL_H_