transport.h (1666B)
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 <stdint.h> 15 16 #include "api/array_view.h" 17 18 namespace webrtc { 19 20 // TODO(holmer): Look into unifying this with the PacketOptions in 21 // asyncpacketsocket.h. 22 struct PacketOptions { 23 PacketOptions(); 24 PacketOptions(const PacketOptions&); 25 ~PacketOptions(); 26 27 // Negative ids are invalid and should be interpreted 28 // as packet_id not being set. 29 int64_t packet_id = -1; 30 // Whether this is an audio or video packet, excluding retransmissions. 31 // Defaults to `false` which is the more common case. 32 bool is_media = false; 33 bool included_in_feedback = false; 34 bool included_in_allocation = false; 35 bool send_as_ect1 = false; 36 // Whether this packet can be part of a packet batch at lower levels. 37 bool batchable = false; 38 // Whether this packet is the last of a batch. 39 bool last_packet_in_batch = false; 40 }; 41 42 class Transport { 43 public: 44 virtual bool SendRtp(ArrayView<const uint8_t> packet, 45 const PacketOptions& options) = 0; 46 virtual bool SendRtcp(ArrayView<const uint8_t> packet, 47 const PacketOptions& options) = 0; 48 49 protected: 50 virtual ~Transport() = default; 51 }; 52 53 } // namespace webrtc 54 55 #endif // API_CALL_TRANSPORT_H_