h264rtppacketizer.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_H264_RTP_PACKETIZER_H
  9. #define RTC_H264_RTP_PACKETIZER_H
  10. #if RTC_ENABLE_MEDIA
  11. #include "mediahandlerrootelement.hpp"
  12. #include "nalunit.hpp"
  13. #include "rtppacketizer.hpp"
  14. namespace rtc {
  15. /// RTP packetization of h264 payload
  16. class RTC_CPP_EXPORT H264RtpPacketizer final : public RtpPacketizer,
  17. public MediaHandlerRootElement {
  18. shared_ptr<NalUnits> splitMessage(binary_ptr message);
  19. const uint16_t maximumFragmentSize;
  20. public:
  21. /// Default clock rate for H264 in RTP
  22. inline static const uint32_t defaultClockRate = 90 * 1000;
  23. H264RtpPacketizer(NalUnit::Separator separator,
  24. shared_ptr<RtpPacketizationConfig> rtpConfig,
  25. uint16_t maximumFragmentSize = NalUnits::defaultMaximumFragmentSize);
  26. /// Constructs h264 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. H264RtpPacketizer(shared_ptr<RtpPacketizationConfig> rtpConfig,
  32. uint16_t maximumFragmentSize = NalUnits::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_H264_RTP_PACKETIZER_H */