rtcpsrreporter.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. // deprecated, do not call
  27. [[deprecated]] void startRecording();
  28. [[deprecated]] uint32_t previousReportedTimestamp() const { return lastReportedTimestamp(); }
  29. private:
  30. uint32_t mPacketCount = 0;
  31. uint32_t mPayloadOctets = 0;
  32. uint32_t mLastReportedTimestamp = 0;
  33. bool mNeedsToReport = false;
  34. };
  35. } // namespace rtc
  36. #endif /* RTC_ENABLE_MEDIA */
  37. #endif /* RTC_RTCP_SENDER_REPORTABLE_H */