rtcpsrreporter.hpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 "rtppacketizationconfig.hpp"
  13. #include "rtp.hpp"
  14. namespace rtc {
  15. class RTC_CPP_EXPORT RtcpSrReporter final : public MediaHandler {
  16. public:
  17. RtcpSrReporter(shared_ptr<RtpPacketizationConfig> rtpConfig);
  18. uint32_t lastReportedTimestamp() const;
  19. void setNeedsToReport();
  20. void outgoing(message_vector &messages, const message_callback &send) override;
  21. // TODO: remove this
  22. const shared_ptr<RtpPacketizationConfig> rtpConfig;
  23. private:
  24. void addToReport(RtpHeader *rtp, uint32_t rtpSize);
  25. message_ptr getSenderReport(uint32_t timestamp);
  26. uint32_t mPacketCount = 0;
  27. uint32_t mPayloadOctets = 0;
  28. uint32_t mLastReportedTimestamp = 0;
  29. bool mNeedsToReport = false;
  30. };
  31. } // namespace rtc
  32. #endif /* RTC_ENABLE_MEDIA */
  33. #endif /* RTC_RTCP_SR_REPORTER_H */