rtcpsrreporter.hpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_SENDER_REPORTABLE_H
  9. #define RTC_RTCP_SENDER_REPORTABLE_H
  10. #if RTC_ENABLE_MEDIA
  11. #include "mediahandlerelement.hpp"
  12. #include "message.hpp"
  13. #include "rtppacketizationconfig.hpp"
  14. namespace rtc {
  15. class RTC_CPP_EXPORT RtcpSrReporter final : public MediaHandlerElement {
  16. void addToReport(RtpHeader *rtp, uint32_t rtpSize);
  17. message_ptr getSenderReport(uint32_t timestamp);
  18. public:
  19. /// RTP configuration
  20. const shared_ptr<RtpPacketizationConfig> rtpConfig;
  21. RtcpSrReporter(shared_ptr<RtpPacketizationConfig> rtpConfig);
  22. ChainedOutgoingProduct processOutgoingBinaryMessage(ChainedMessagesProduct messages,
  23. message_ptr control) override;
  24. uint32_t lastReportedTimestamp() const;
  25. void setNeedsToReport();
  26. private:
  27. uint32_t mPacketCount = 0;
  28. uint32_t mPayloadOctets = 0;
  29. uint32_t mLastReportedTimestamp = 0;
  30. bool mNeedsToReport = false;
  31. };
  32. } // namespace rtc
  33. #endif /* RTC_ENABLE_MEDIA */
  34. #endif /* RTC_RTCP_SENDER_REPORTABLE_H */