blob: 04d2ef39da4e130c0e2fcb8d8c29f018b133854d [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
Zhi Huang942bc2e2017-11-13 13:26:07 -080014#include <string>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "api/ortc/rtptransportinterface.h"
Zhi Huang942bc2e2017-11-13 13:26:07 -080017#include "p2p/base/icetransportinternal.h"
18#include "rtc_base/networkroute.h"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "rtc_base/sigslot.h"
zstein398c3fd2017-07-19 13:38:02 -070020
21namespace rtc {
22class CopyOnWriteBuffer;
23struct PacketOptions;
24struct PacketTime;
25} // namespace rtc
26
27namespace webrtc {
28
29// This represents the internal interface beneath RtpTransportInterface;
30// it is not accessible to API consumers but is accessible to internal classes
31// in order to send and receive RTP and RTCP packets belonging to a single RTP
32// session. Additional convenience and configuration methods are also provided.
33class RtpTransportInternal : public RtpTransportInterface,
34 public sigslot::has_slots<> {
35 public:
36 virtual void SetRtcpMuxEnabled(bool enable) = 0;
37
38 // TODO(zstein): Remove PacketTransport setters. Clients should pass these
39 // in to constructors instead and construct a new RtpTransportInternal instead
40 // of updating them.
41
42 virtual rtc::PacketTransportInternal* rtp_packet_transport() const = 0;
43 virtual void SetRtpPacketTransport(rtc::PacketTransportInternal* rtp) = 0;
44
45 virtual rtc::PacketTransportInternal* rtcp_packet_transport() const = 0;
46 virtual void SetRtcpPacketTransport(rtc::PacketTransportInternal* rtcp) = 0;
47
48 // Called whenever a transport's ready-to-send state changes. The argument
49 // is true if all used transports are ready to send. This is more specific
50 // than just "writable"; it means the last send didn't return ENOTCONN.
51 sigslot::signal1<bool> SignalReadyToSend;
52
53 // TODO(zstein): Consider having two signals - RtpPacketReceived and
54 // RtcpPacketReceived.
55 // The first argument is true for RTCP packets and false for RTP packets.
56 sigslot::signal3<bool, rtc::CopyOnWriteBuffer*, const rtc::PacketTime&>
57 SignalPacketReceived;
58
Zhi Huang942bc2e2017-11-13 13:26:07 -080059 // Called whenever the network route of the P2P layer transport changes.
60 // The argument is an optional network route.
61 sigslot::signal1<rtc::Optional<rtc::NetworkRoute>> SignalNetworkRouteChanged;
62
zstein398c3fd2017-07-19 13:38:02 -070063 virtual bool IsWritable(bool rtcp) const = 0;
64
Zhi Huangcf990f52017-09-22 12:12:30 -070065 virtual bool SendRtpPacket(rtc::CopyOnWriteBuffer* packet,
66 const rtc::PacketOptions& options,
67 int flags) = 0;
68
69 virtual bool SendRtcpPacket(rtc::CopyOnWriteBuffer* packet,
70 const rtc::PacketOptions& options,
71 int flags) = 0;
zstein398c3fd2017-07-19 13:38:02 -070072
73 virtual bool HandlesPayloadType(int payload_type) const = 0;
74
75 virtual void AddHandledPayloadType(int payload_type) = 0;
76};
77
78} // namespace webrtc
79
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020080#endif // PC_RTPTRANSPORTINTERNAL_H_