| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef API_RTP_PACKET_INFO_H_ |
| 12 |
#define API_RTP_PACKET_INFO_H_ |
| 13 |
|
| 14 |
#include <cstdint> |
| 15 |
#include <utility> |
| 16 |
#include <vector> |
| 17 |
|
| 18 |
#include "absl/types/optional.h" |
| 19 |
#include "api/rtp_headers.h" |
| 20 |
#include "rtc_base/system/rtc_export.h" |
| 21 |
|
| 22 |
namespace webrtc { |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
class RTC_EXPORT RtpPacketInfo { |
| 30 |
public: |
| 31 |
RtpPacketInfo(); |
| 32 |
|
| 33 |
RtpPacketInfo(uint32_t ssrc, |
| 34 |
std::vector<uint32_t> csrcs, |
| 35 |
uint32_t rtp_timestamp, |
| 36 |
absl::optional<uint8_t> audio_level, |
| 37 |
absl::optional<AbsoluteCaptureTime> absolute_capture_time, |
| 38 |
int64_t receive_time_ms); |
| 39 |
|
| 40 |
RtpPacketInfo(const RTPHeader& rtp_header, int64_t receive_time_ms); |
| 41 |
|
| 42 |
RtpPacketInfo(const RtpPacketInfo& other) = default; |
| 43 |
RtpPacketInfo(RtpPacketInfo&& other) = default; |
| 44 |
RtpPacketInfo& operator=(const RtpPacketInfo& other) = default; |
| 45 |
RtpPacketInfo& operator=(RtpPacketInfo&& other) = default; |
| 46 |
|
| 47 |
uint32_t ssrc() const { return ssrc_; } |
| 48 |
void set_ssrc(uint32_t value) { ssrc_ = value; } |
| 49 |
|
| 50 |
const std::vector<uint32_t>& csrcs() const { return csrcs_; } |
| 51 |
void set_csrcs(std::vector<uint32_t> value) { csrcs_ = std::move(value); } |
| 52 |
|
| 53 |
uint32_t rtp_timestamp() const { return rtp_timestamp_; } |
| 54 |
void set_rtp_timestamp(uint32_t value) { rtp_timestamp_ = value; } |
| 55 |
|
| 56 |
absl::optional<uint8_t> audio_level() const { return audio_level_; } |
| 57 |
void set_audio_level(absl::optional<uint8_t> value) { audio_level_ = value; } |
| 58 |
|
| 59 |
const absl::optional<AbsoluteCaptureTime>& absolute_capture_time() const { |
| 60 |
return absolute_capture_time_; |
| 61 |
} |
| 62 |
void set_absolute_capture_time( |
| 63 |
const absl::optional<AbsoluteCaptureTime>& value) { |
| 64 |
absolute_capture_time_ = value; |
| 65 |
} |
| 66 |
|
| 67 |
int64_t receive_time_ms() const { return receive_time_ms_; } |
| 68 |
void set_receive_time_ms(int64_t value) { receive_time_ms_ = value; } |
| 69 |
|
| 70 |
private: |
| 71 |
|
| 72 |
|
| 73 |
uint32_t ssrc_; |
| 74 |
std::vector<uint32_t> csrcs_; |
| 75 |
uint32_t rtp_timestamp_; |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
absl::optional<uint8_t> audio_level_; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
absl::optional<AbsoluteCaptureTime> absolute_capture_time_; |
| 84 |
|
| 85 |
|
| 86 |
int64_t receive_time_ms_; |
| 87 |
}; |
| 88 |
|
| 89 |
bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs); |
| 90 |
|
| 91 |
inline bool operator!=(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs) { |
| 92 |
return !(lhs == rhs); |
| 93 |
} |
| 94 |
|
| 95 |
} |
| 96 |
|
| 97 |
#endif |