rtcpreceivingsession.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Copyright (c) 2020 Staz Modrzynski
  3. * Copyright (c) 2020 Paul-Louis Ageneau
  4. *
  5. * This Source Code Form is subject to the terms of the Mozilla Public
  6. * License, v. 2.0. If a copy of the MPL was not distributed with this
  7. * file, You can obtain one at https://mozilla.org/MPL/2.0/.
  8. */
  9. #ifndef RTC_RTCP_RECEIVING_SESSION_H
  10. #define RTC_RTCP_RECEIVING_SESSION_H
  11. #if RTC_ENABLE_MEDIA
  12. #include "common.hpp"
  13. #include "mediahandler.hpp"
  14. #include "message.hpp"
  15. #include "rtp.hpp"
  16. #include <atomic>
  17. namespace rtc {
  18. // An RtcpSession can be plugged into a Track to handle the whole RTCP session
  19. class RTC_CPP_EXPORT RtcpReceivingSession : public MediaHandler {
  20. public:
  21. RtcpReceivingSession() = default;
  22. virtual ~RtcpReceivingSession() = default;
  23. void incoming(message_vector &messages, const message_callback &send) override;
  24. bool requestKeyframe(const message_callback &send) override;
  25. bool requestBitrate(unsigned int bitrate, const message_callback &send) override;
  26. // For backward compatibility
  27. [[deprecated("Use Track::requestKeyframe()")]] inline bool requestKeyframe() { return false; };
  28. [[deprecated("Use Track::requestBitrate()")]] inline void requestBitrate(unsigned int) {};
  29. protected:
  30. void pushREMB(const message_callback &send, unsigned int bitrate);
  31. void pushRR(const message_callback &send,unsigned int lastSrDelay);
  32. void pushPLI(const message_callback &send);
  33. SSRC mSsrc = 0;
  34. uint32_t mGreatestSeqNo = 0;
  35. uint64_t mSyncRTPTS, mSyncNTPTS;
  36. std::atomic<unsigned int> mRequestedBitrate = 0;
  37. };
  38. } // namespace rtc
  39. #endif // RTC_ENABLE_MEDIA
  40. #endif // RTC_RTCP_RECEIVING_SESSION_H