h265rtppacketizer.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Copyright (c) 2023 Zita Liao (Dolby)
  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_H265_RTP_PACKETIZER_H
  9. #define RTC_H265_RTP_PACKETIZER_H
  10. #if RTC_ENABLE_MEDIA
  11. #include "h265nalunit.hpp"
  12. #include "mediahandlerrootelement.hpp"
  13. #include "rtppacketizer.hpp"
  14. namespace rtc {
  15. /// RTP packetization of h265 payload
  16. class RTC_CPP_EXPORT H265RtpPacketizer final : public RtpPacketizer,
  17. public MediaHandlerRootElement {
  18. shared_ptr<H265NalUnits> splitMessage(binary_ptr message);
  19. const uint16_t maximumFragmentSize;
  20. public:
  21. using Separator = NalUnit::Separator;
  22. /// Default clock rate for H265 in RTP
  23. inline static const uint32_t defaultClockRate = 90 * 1000;
  24. H265RtpPacketizer(NalUnit::Separator separator, shared_ptr<RtpPacketizationConfig> rtpConfig,
  25. uint16_t maximumFragmentSize = H265NalUnits::defaultMaximumFragmentSize);
  26. /// Constructs h265 payload packetizer with given RTP configuration.
  27. /// @note RTP configuration is used in packetization process which may change some configuration
  28. /// properties such as sequence number.
  29. /// @param rtpConfig RTP configuration
  30. /// @param maximumFragmentSize maximum size of one NALU fragment
  31. H265RtpPacketizer(shared_ptr<RtpPacketizationConfig> rtpConfig,
  32. uint16_t maximumFragmentSize = H265NalUnits::defaultMaximumFragmentSize);
  33. ChainedOutgoingProduct processOutgoingBinaryMessage(ChainedMessagesProduct messages,
  34. message_ptr control) override;
  35. private:
  36. const NalUnit::Separator separator;
  37. };
  38. } // namespace rtc
  39. #endif /* RTC_ENABLE_MEDIA */
  40. #endif /* RTC_H265_RTP_PACKETIZER_H */