Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
rtp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Roc authors
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 
9 //! @file roc_packet/rtp.h
10 //! @brief RTP packet.
11 
12 #ifndef ROC_PACKET_RTP_H_
13 #define ROC_PACKET_RTP_H_
14 
15 #include "roc_core/slice.h"
16 #include "roc_core/stddefs.h"
17 #include "roc_packet/units.h"
18 
19 namespace roc {
20 namespace packet {
21 
22 //! RTP packet.
23 struct RTP {
24  //! Packet source ID identifying packet stream.
25  //! @remarks
26  //! Sequence numbers and timestamp are numbered independently inside
27  //! different packet streams.
29 
30  //! Packet sequence number in packet stream.
31  //! @remarks
32  //! Packets are numbered sequentaly in every stream, starting from some
33  //! random value. May overflow.
35 
36  //! Packet timestamp.
37  //! @remarks
38  //! Timestamp units and exact meaning depends on packet type. For example,
39  //! it may be used to define the number of the first sample in packet, or
40  //! the time when the packet were generated.
42 
43  //! Packet duration.
44  //! @remarks
45  //! Duration is measured in the same units as timestamp.
47 
48  //! Packet marker bit.
49  //! @remarks
50  //! Marker bit meaning depends on packet type.
51  bool marker;
52 
53  //! Packet payload type.
54  unsigned int payload_type;
55 
56  //! Packet header.
58 
59  //! Packet payload.
60  //! @remarks
61  //! Doesn't include RTP headers and padding.
63 
64  //! Packet padding.
65  //! @remarks
66  //! Not included in header and payload, but affects overall packet size.
68 
69  //! Construct zero RTP packet.
70  RTP();
71 
72  //! Determine packet order.
73  int compare(const RTP&) const;
74 };
75 
76 } // namespace packet
77 } // namespace roc
78 
79 #endif // ROC_PACKET_RTP_H_
RTP()
Construct zero RTP packet.
source_t source
Packet source ID identifying packet stream.
Definition: rtp.h:28
timestamp_t duration
Packet duration.
Definition: rtp.h:46
core::Slice< uint8_t > padding
Packet padding.
Definition: rtp.h:67
unsigned int payload_type
Packet payload type.
Definition: rtp.h:54
Root namespace.
core::Slice< uint8_t > payload
Packet payload.
Definition: rtp.h:62
uint32_t source_t
Packet source ID identifying packet stream.
Definition: units.h:22
uint32_t timestamp_t
Audio packet timestamp.
Definition: units.h:46
Commonly used types and functions.
RTP packet.
Definition: rtp.h:23
timestamp_t timestamp
Packet timestamp.
Definition: rtp.h:41
Slice.
core::Slice< uint8_t > header
Packet header.
Definition: rtp.h:57
Various units used in packets.
bool marker
Packet marker bit.
Definition: rtp.h:51
seqnum_t seqnum
Packet sequence number in packet stream.
Definition: rtp.h:34
uint16_t seqnum_t
Packet sequence number in packet stream.
Definition: units.h:25
int compare(const RTP &) const
Determine packet order.