rtppacketizer.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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_RTP_PACKETIZER_H
  9. #define RTC_RTP_PACKETIZER_H
  10. #if RTC_ENABLE_MEDIA
  11. #include "message.hpp"
  12. #include "rtppacketizationconfig.hpp"
  13. namespace rtc {
  14. /// Class responsible for RTP packetization
  15. class RTC_CPP_EXPORT RtpPacketizer {
  16. static const auto rtpHeaderSize = 12;
  17. static const auto rtpExtHeaderCvoSize = 8;
  18. public:
  19. // RTP configuration
  20. const shared_ptr<RtpPacketizationConfig> rtpConfig;
  21. /// Constructs packetizer with given RTP configuration.
  22. /// @note RTP configuration is used in packetization process which may change some configuration
  23. /// properties such as sequence number.
  24. /// @param rtpConfig RTP configuration
  25. RtpPacketizer(shared_ptr<RtpPacketizationConfig> rtpConfig);
  26. /// Creates RTP packet for given payload based on `rtpConfig`.
  27. /// @note This function increase sequence number after packetization.
  28. /// @param payload RTP payload
  29. /// @param setMark Set marker flag in RTP packet if true
  30. virtual shared_ptr<binary> packetize(shared_ptr<binary> payload, bool setMark);
  31. };
  32. } // namespace rtc
  33. #endif /* RTC_ENABLE_MEDIA */
  34. #endif /* RTC_RTP_PACKETIZER_H */