OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 const RTPExtensionType type; | 66 const RTPExtensionType type; |
67 uint8_t length; | 67 uint8_t length; |
68 bool active; | 68 bool active; |
69 }; | 69 }; |
70 | 70 |
71 class RtpHeaderExtensionMap { | 71 class RtpHeaderExtensionMap { |
72 public: | 72 public: |
| 73 static constexpr RTPExtensionType kInvalidType = kRtpExtensionNone; |
| 74 static constexpr uint8_t kInvalidId = 0; |
73 RtpHeaderExtensionMap(); | 75 RtpHeaderExtensionMap(); |
74 ~RtpHeaderExtensionMap(); | 76 ~RtpHeaderExtensionMap(); |
75 | 77 |
76 void Erase(); | 78 void Erase(); |
77 | 79 |
78 int32_t Register(const RTPExtensionType type, const uint8_t id); | 80 int32_t Register(const RTPExtensionType type, const uint8_t id); |
79 | 81 |
80 // Active is a concept for a registered rtp header extension which doesn't | 82 // Active is a concept for a registered rtp header extension which doesn't |
81 // take effect yet until being activated. Inactive RTP header extensions do | 83 // take effect yet until being activated. Inactive RTP header extensions do |
82 // not take effect and should not be included in size calculations until they | 84 // not take effect and should not be included in size calculations until they |
83 // are activated. | 85 // are activated. |
84 int32_t RegisterInactive(const RTPExtensionType type, const uint8_t id); | 86 int32_t RegisterInactive(const RTPExtensionType type, const uint8_t id); |
85 bool SetActive(const RTPExtensionType type, bool active); | 87 bool SetActive(const RTPExtensionType type, bool active); |
86 | 88 |
87 int32_t Deregister(const RTPExtensionType type); | 89 int32_t Deregister(const RTPExtensionType type); |
88 | 90 |
89 bool IsRegistered(RTPExtensionType type) const; | 91 bool IsRegistered(RTPExtensionType type) const; |
90 | 92 |
91 int32_t GetType(const uint8_t id, RTPExtensionType* type) const; | 93 int32_t GetType(const uint8_t id, RTPExtensionType* type) const; |
| 94 // Return kInvalidType if not found. |
| 95 RTPExtensionType GetType(uint8_t id) const; |
92 | 96 |
93 int32_t GetId(const RTPExtensionType type, uint8_t* id) const; | 97 int32_t GetId(const RTPExtensionType type, uint8_t* id) const; |
| 98 // Return kInvalidId if not found. |
| 99 uint8_t GetId(RTPExtensionType type) const; |
94 | 100 |
95 // | 101 // |
96 // Methods below ignore any inactive rtp header extensions. | 102 // Methods below ignore any inactive rtp header extensions. |
97 // | 103 // |
98 | 104 |
99 size_t GetTotalLengthInBytes() const; | 105 size_t GetTotalLengthInBytes() const; |
100 | 106 |
101 int32_t GetLengthUntilBlockStartInBytes(const RTPExtensionType type) const; | 107 int32_t GetLengthUntilBlockStartInBytes(const RTPExtensionType type) const; |
102 | 108 |
103 void GetCopy(RtpHeaderExtensionMap* map) const; | 109 void GetCopy(RtpHeaderExtensionMap* map) const; |
104 | 110 |
105 int32_t Size() const; | 111 int32_t Size() const; |
106 | 112 |
107 RTPExtensionType First() const; | 113 RTPExtensionType First() const; |
108 | 114 |
109 RTPExtensionType Next(RTPExtensionType type) const; | 115 RTPExtensionType Next(RTPExtensionType type) const; |
110 | 116 |
111 private: | 117 private: |
112 int32_t Register(const RTPExtensionType type, const uint8_t id, bool active); | 118 int32_t Register(const RTPExtensionType type, const uint8_t id, bool active); |
113 std::map<uint8_t, HeaderExtension*> extensionMap_; | 119 std::map<uint8_t, HeaderExtension*> extensionMap_; |
114 }; | 120 }; |
115 } // namespace webrtc | 121 } // namespace webrtc |
116 | 122 |
117 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_ | 123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_ |
118 | 124 |
OLD | NEW |