2
0

h265rtppacketizer.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 "rtppacketizer.hpp"
  13. namespace rtc {
  14. // RTP packetization for H265
  15. class RTC_CPP_EXPORT H265RtpPacketizer final : public RtpPacketizer {
  16. public:
  17. using Separator = NalUnit::Separator;
  18. inline static const uint32_t ClockRate = VideoClockRate;
  19. [[deprecated("Use ClockRate")]] inline static const uint32_t defaultClockRate = ClockRate;
  20. // Constructs h265 payload packetizer with given RTP configuration.
  21. // @note RTP configuration is used in packetization process which may change some configuration
  22. // properties such as sequence number.
  23. // @param separator NAL unit separator
  24. // @param rtpConfig RTP configuration
  25. // @param maxFragmentSize maximum size of one NALU fragment
  26. H265RtpPacketizer(Separator separator, shared_ptr<RtpPacketizationConfig> rtpConfig,
  27. size_t maxFragmentSize = DefaultMaxFragmentSize);
  28. // For backward compatibility, do not use
  29. [[deprecated]] H265RtpPacketizer(shared_ptr<RtpPacketizationConfig> rtpConfig,
  30. size_t maxFragmentSize = DefaultMaxFragmentSize);
  31. private:
  32. std::vector<binary> fragment(binary data) override;
  33. std::vector<H265NalUnit> splitFrame(const binary &frame);
  34. const NalUnit::Separator mSeparator;
  35. const size_t mMaxFragmentSize;
  36. };
  37. // For backward compatibility, do not use
  38. using H265PacketizationHandler [[deprecated("Add H265RtpPacketizer directly")]] = PacketizationHandler;
  39. } // namespace rtc
  40. #endif /* RTC_ENABLE_MEDIA */
  41. #endif /* RTC_H265_RTP_PACKETIZER_H */