12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_EXTENSION_MAP_H_
- #define MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_EXTENSION_MAP_H_
- #include <stdint.h>
- #include <string>
- #include "../rtp_header_extension/rtp_header_extension_defines.h"
- class RtpHeaderExtensionMap {
- public:
- static const RTPExtensionType kInvalidType = kRtpExtensionNone;
- static const int kInvalidId = 0;
- RtpHeaderExtensionMap();
- explicit RtpHeaderExtensionMap(bool extmap_allow_mixed);
- template <typename Extension>
- bool Register(int id) {
- return Register(id, Extension::kId, Extension::kUri);
- }
- bool RegisterByType(int id, RTPExtensionType type);
- bool RegisterByUri(int id, const std::string& uri);
- bool IsRegistered(RTPExtensionType type) const {
- return GetId(type) != kInvalidId;
- }
- // Return kInvalidType if not found.
- RTPExtensionType GetType(int id) const;
- // Return kInvalidId if not found.
- uint8_t GetId(RTPExtensionType type) const {
- return ids_[type];
- }
- // TODO(danilchap): Remove use of the functions below.
- int32_t Register(RTPExtensionType type, int id) {
- return RegisterByType(id, type) ? 0 : -1;
- }
- int32_t Deregister(RTPExtensionType type);
- // Corresponds to the SDP attribute extmap-allow-mixed, see RFC8285.
- // Set to true if it's allowed to mix one- and two-byte RTP header extensions
- // in the same stream.
- bool ExtmapAllowMixed() const { return extmap_allow_mixed_; }
- void SetExtmapAllowMixed(bool extmap_allow_mixed) {
- extmap_allow_mixed_ = extmap_allow_mixed;
- }
- private:
- bool Register(int id, RTPExtensionType type, const char* uri);
- uint8_t ids_[kRtpExtensionNumberOfExtensions];
- bool extmap_allow_mixed_;
- };
- #endif // MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_EXTENSION_MAP_H_
|