h265rtppacketizer.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /// Default clock rate for H265 in RTP
  22. inline static const uint32_t defaultClockRate = 90 * 1000;
  23. H265RtpPacketizer(NalUnit::Separator separator, shared_ptr<RtpPacketizationConfig> rtpConfig,
  24. uint16_t maximumFragmentSize = H265NalUnits::defaultMaximumFragmentSize);
  25. /// Constructs h265 payload packetizer with given RTP configuration.
  26. /// @note RTP configuration is used in packetization process which may change some configuration
  27. /// properties such as sequence number.
  28. /// @param rtpConfig RTP configuration
  29. /// @param maximumFragmentSize maximum size of one NALU fragment
  30. H265RtpPacketizer(shared_ptr<RtpPacketizationConfig> rtpConfig,
  31. uint16_t maximumFragmentSize = H265NalUnits::defaultMaximumFragmentSize);
  32. ChainedOutgoingProduct processOutgoingBinaryMessage(ChainedMessagesProduct messages,
  33. message_ptr control) override;
  34. private:
  35. const NalUnit::Separator separator;
  36. };
  37. } // namespace rtc
  38. #endif /* RTC_ENABLE_MEDIA */
  39. #endif /* RTC_H265_RTP_PACKETIZER_H */