xref: /aosp_15_r20/external/webrtc/api/call/transport.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2013 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 API_CALL_TRANSPORT_H_
12 #define API_CALL_TRANSPORT_H_
13 
14 #include <stddef.h>
15 #include <stdint.h>
16 
17 #include "api/ref_counted_base.h"
18 #include "api/scoped_refptr.h"
19 
20 namespace webrtc {
21 
22 // TODO(holmer): Look into unifying this with the PacketOptions in
23 // asyncpacketsocket.h.
24 struct PacketOptions {
25   PacketOptions();
26   PacketOptions(const PacketOptions&);
27   ~PacketOptions();
28 
29   // A 16 bits positive id. Negative ids are invalid and should be interpreted
30   // as packet_id not being set.
31   int packet_id = -1;
32   // Additional data bound to the RTP packet for use in application code,
33   // outside of WebRTC.
34   rtc::scoped_refptr<rtc::RefCountedBase> additional_data;
35   // Whether this is a retransmission of an earlier packet.
36   bool is_retransmit = false;
37   bool included_in_feedback = false;
38   bool included_in_allocation = false;
39 };
40 
41 class Transport {
42  public:
43   virtual bool SendRtp(const uint8_t* packet,
44                        size_t length,
45                        const PacketOptions& options) = 0;
46   virtual bool SendRtcp(const uint8_t* packet, size_t length) = 0;
47 
48  protected:
~Transport()49   virtual ~Transport() {}
50 };
51 
52 }  // namespace webrtc
53 
54 #endif  // API_CALL_TRANSPORT_H_
55