123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- #ifndef API_RTP_HEADERS_H_
- #define API_RTP_HEADERS_H_
- #include <stddef.h>
- #include <stdint.h>
- #include <string>
- #include "absl/types/optional.h"
- #include "api/array_view.h"
- #include "api/units/timestamp.h"
- #include "api/video/color_space.h"
- #include "api/video/video_content_type.h"
- #include "api/video/video_rotation.h"
- #include "api/video/video_timing.h"
- #include "common_types.h"
- namespace webrtc {
- struct FeedbackRequest {
-
-
-
- bool include_timestamps;
-
-
-
- int sequence_count;
- };
- struct AbsoluteCaptureTime {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- uint64_t absolute_capture_timestamp;
-
-
-
-
-
-
-
-
-
-
-
-
-
- absl::optional<int64_t> estimated_capture_clock_offset;
- };
- inline bool operator==(const AbsoluteCaptureTime& lhs,
- const AbsoluteCaptureTime& rhs) {
- return (lhs.absolute_capture_timestamp == rhs.absolute_capture_timestamp) &&
- (lhs.estimated_capture_clock_offset ==
- rhs.estimated_capture_clock_offset);
- }
- inline bool operator!=(const AbsoluteCaptureTime& lhs,
- const AbsoluteCaptureTime& rhs) {
- return !(lhs == rhs);
- }
- struct RTPHeaderExtension {
- RTPHeaderExtension();
- RTPHeaderExtension(const RTPHeaderExtension& other);
- RTPHeaderExtension& operator=(const RTPHeaderExtension& other);
- static constexpr int kAbsSendTimeFraction = 18;
- Timestamp GetAbsoluteSendTimestamp() const {
- RTC_DCHECK(hasAbsoluteSendTime);
- RTC_DCHECK(absoluteSendTime < (1ul << 24));
- return Timestamp::Micros((absoluteSendTime * 1000000ll) /
- (1 << kAbsSendTimeFraction));
- }
- TimeDelta GetAbsoluteSendTimeDelta(uint32_t previous_sendtime) const {
- RTC_DCHECK(hasAbsoluteSendTime);
- RTC_DCHECK(absoluteSendTime < (1ul << 24));
- RTC_DCHECK(previous_sendtime < (1ul << 24));
- int32_t delta =
- static_cast<int32_t>((absoluteSendTime - previous_sendtime) << 8) >> 8;
- return TimeDelta::Micros((delta * 1000000ll) / (1 << kAbsSendTimeFraction));
- }
- bool hasTransmissionTimeOffset;
- int32_t transmissionTimeOffset;
- bool hasAbsoluteSendTime;
- uint32_t absoluteSendTime;
- absl::optional<AbsoluteCaptureTime> absolute_capture_time;
- bool hasTransportSequenceNumber;
- uint16_t transportSequenceNumber;
- absl::optional<FeedbackRequest> feedback_request;
-
-
- bool hasAudioLevel;
- bool voiceActivity;
- uint8_t audioLevel;
-
-
-
- bool hasVideoRotation;
- VideoRotation videoRotation;
-
-
- bool hasVideoContentType;
- VideoContentType videoContentType;
- bool has_video_timing;
- VideoSendTiming video_timing;
- PlayoutDelay playout_delay = {-1, -1};
-
-
-
- std::string stream_id;
- std::string repaired_stream_id;
-
-
- std::string mid;
- absl::optional<ColorSpace> color_space;
- };
- enum { kRtpCsrcSize = 15 };
- struct RTPHeader {
- RTPHeader();
- RTPHeader(const RTPHeader& other);
- RTPHeader& operator=(const RTPHeader& other);
- 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;
- int payload_type_frequency;
- RTPHeaderExtension extension;
- };
- enum class RtcpMode { kOff, kCompound, kReducedSize };
- enum NetworkState {
- kNetworkUp,
- kNetworkDown,
- };
- }
- #endif
|