rtcpsrreporter.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Copyright (c) 2020 Filip Klembara (in2core)
  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 https://mozilla.org/MPL/2.0/.
  7. */
  8. #ifndef RTC_RTCP_SR_REPORTER_H
  9. #define RTC_RTCP_SR_REPORTER_H
  10. #if RTC_ENABLE_MEDIA
  11. #include "mediahandler.hpp"
  12. #include "rtp.hpp"
  13. #include "rtppacketizationconfig.hpp"
  14. #include <chrono>
  15. namespace rtc {
  16. class RTC_CPP_EXPORT RtcpSrReporter final : public MediaHandler {
  17. public:
  18. RtcpSrReporter(shared_ptr<RtpPacketizationConfig> rtpConfig);
  19. ~RtcpSrReporter();
  20. uint32_t lastReportedTimestamp() const;
  21. [[deprecated]] void setNeedsToReport();
  22. void outgoing(message_vector &messages, const message_callback &send) override;
  23. // TODO: remove this
  24. const shared_ptr<RtpPacketizationConfig> rtpConfig;
  25. private:
  26. void addToReport(RtpHeader *header, size_t size);
  27. message_ptr getSenderReport(uint32_t timestamp);
  28. uint32_t mPacketCount = 0;
  29. uint32_t mPayloadOctets = 0;
  30. uint32_t mLastReportedTimestamp = 0;
  31. std::chrono::steady_clock::time_point mLastReportTime;
  32. };
  33. } // namespace rtc
  34. #endif /* RTC_ENABLE_MEDIA */
  35. #endif /* RTC_RTCP_SR_REPORTER_H */