rrtr.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2015 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 MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RRTR_H_
  12. #define MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RRTR_H_
  13. #include <stddef.h>
  14. #include <stdint.h>
  15. #include "system_wrappers/include/ntp_time.h"
  16. namespace webrtc {
  17. namespace rtcp {
  18. class Rrtr {
  19. public:
  20. static const uint8_t kBlockType = 4;
  21. static const uint16_t kBlockLength = 2;
  22. static const size_t kLength = 4 * (kBlockLength + 1); // 12
  23. Rrtr() {}
  24. Rrtr(const Rrtr&) = default;
  25. ~Rrtr() {}
  26. Rrtr& operator=(const Rrtr&) = default;
  27. void Parse(const uint8_t* buffer);
  28. // Fills buffer with the Rrtr.
  29. // Consumes Rrtr::kLength bytes.
  30. void Create(uint8_t* buffer) const;
  31. void SetNtp(NtpTime ntp) { ntp_ = ntp; }
  32. NtpTime ntp() const { return ntp_; }
  33. private:
  34. NtpTime ntp_;
  35. };
  36. } // namespace rtcp
  37. } // namespace webrtc
  38. #endif // MODULES_RTP_RTCP_SOURCE_RTCP_PACKET_RRTR_H_