mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-27 04:35:34 +08:00
[feat] rewrite rtp module
This commit is contained in:
@@ -7,40 +7,58 @@
|
||||
#ifndef _RTP_HEADER_H_
|
||||
#define _RTP_HEADER_H_
|
||||
|
||||
#include <chrono>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "api/units/timestamp.h"
|
||||
static constexpr int kMaxRtpCsrcSize = 15;
|
||||
static constexpr uint8_t kRtpVersion = 2;
|
||||
|
||||
static constexpr int kAbsSendTimeFraction = 18;
|
||||
struct RTPHeaderExtension {
|
||||
RTPHeaderExtension();
|
||||
RTPHeaderExtension(const RTPHeaderExtension& other);
|
||||
RTPHeaderExtension& operator=(const RTPHeaderExtension& other);
|
||||
|
||||
enum { kRtpCsrcSize = 15 }; // RFC 3550 page 13
|
||||
static constexpr int kAbsSendTimeFraction = 18;
|
||||
|
||||
bool hasAbsoluteSendTime;
|
||||
uint32_t absoluteSendTime;
|
||||
};
|
||||
|
||||
struct RTPHeader {
|
||||
RTPHeader()
|
||||
: markerBit(false),
|
||||
payloadType(0),
|
||||
sequenceNumber(0),
|
||||
timestamp(0),
|
||||
ssrc(0),
|
||||
numCSRCs(0),
|
||||
arrOfCSRCs(),
|
||||
paddingLength(0),
|
||||
headerLength(0){};
|
||||
: version_(kRtpVersion),
|
||||
has_padding_(false),
|
||||
has_extension_(false),
|
||||
csrc_count_(0),
|
||||
marker_(false),
|
||||
payload_type_(0),
|
||||
sequence_number_(1),
|
||||
timestamp_(0),
|
||||
ssrc_(0),
|
||||
csrcs_(),
|
||||
padding_len(0),
|
||||
header_len(0){};
|
||||
|
||||
RTPHeader(const RTPHeader& other) = default;
|
||||
RTPHeader& operator=(const RTPHeader& other) = default;
|
||||
|
||||
bool markerBit;
|
||||
uint8_t payloadType;
|
||||
uint16_t sequenceNumber;
|
||||
uint32_t timestamp;
|
||||
uint32_t ssrc;
|
||||
uint8_t numCSRCs;
|
||||
uint32_t arrOfCSRCs[kRtpCsrcSize];
|
||||
size_t paddingLength;
|
||||
size_t headerLength;
|
||||
uint8_t version_ = 0;
|
||||
bool has_padding_ = false;
|
||||
bool has_extension_ = false;
|
||||
uint8_t csrc_count_ = 0;
|
||||
bool marker_ = false;
|
||||
uint8_t payload_type_ = 0;
|
||||
uint16_t sequence_number_ = 1;
|
||||
uint64_t timestamp_ = 0;
|
||||
uint32_t ssrc_ = 0;
|
||||
uint32_t csrcs_[kRtpCsrcSize];
|
||||
size_t padding_len;
|
||||
size_t header_len;
|
||||
|
||||
RTPHeaderExtension extension;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user