| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 std::map<uint8_t, HeaderExtension*>::const_iterator it = | 105 std::map<uint8_t, HeaderExtension*>::const_iterator it = |
| 106 extensionMap_.find(id); | 106 extensionMap_.find(id); |
| 107 if (it == extensionMap_.end()) { | 107 if (it == extensionMap_.end()) { |
| 108 return -1; | 108 return -1; |
| 109 } | 109 } |
| 110 HeaderExtension* extension = it->second; | 110 HeaderExtension* extension = it->second; |
| 111 *type = extension->type; | 111 *type = extension->type; |
| 112 return 0; | 112 return 0; |
| 113 } | 113 } |
| 114 | 114 |
| 115 RTPExtensionType RtpHeaderExtensionMap::GetType(uint8_t id) const { |
| 116 auto it = extensionMap_.find(id); |
| 117 if (it == extensionMap_.end()) { |
| 118 return kInvalidType; |
| 119 } |
| 120 return it->second->type; |
| 121 } |
| 122 |
| 115 int32_t RtpHeaderExtensionMap::GetId(const RTPExtensionType type, | 123 int32_t RtpHeaderExtensionMap::GetId(const RTPExtensionType type, |
| 116 uint8_t* id) const { | 124 uint8_t* id) const { |
| 117 assert(id); | 125 assert(id); |
| 118 std::map<uint8_t, HeaderExtension*>::const_iterator it = | 126 std::map<uint8_t, HeaderExtension*>::const_iterator it = |
| 119 extensionMap_.begin(); | 127 extensionMap_.begin(); |
| 120 | 128 |
| 121 while (it != extensionMap_.end()) { | 129 while (it != extensionMap_.end()) { |
| 122 HeaderExtension* extension = it->second; | 130 HeaderExtension* extension = it->second; |
| 123 if (extension->type == type) { | 131 if (extension->type == type) { |
| 124 *id = it->first; | 132 *id = it->first; |
| 125 return 0; | 133 return 0; |
| 126 } | 134 } |
| 127 it++; | 135 it++; |
| 128 } | 136 } |
| 129 return -1; | 137 return -1; |
| 130 } | 138 } |
| 131 | 139 |
| 140 uint8_t RtpHeaderExtensionMap::GetId(RTPExtensionType type) const { |
| 141 for (auto kv : extensionMap_) { |
| 142 if (kv.second->type == type) |
| 143 return kv.first; |
| 144 } |
| 145 return kInvalidId; |
| 146 } |
| 147 |
| 132 size_t RtpHeaderExtensionMap::GetTotalLengthInBytes() const { | 148 size_t RtpHeaderExtensionMap::GetTotalLengthInBytes() const { |
| 133 // Get length for each extension block. | 149 // Get length for each extension block. |
| 134 size_t length = 0; | 150 size_t length = 0; |
| 135 std::map<uint8_t, HeaderExtension*>::const_iterator it = | 151 std::map<uint8_t, HeaderExtension*>::const_iterator it = |
| 136 extensionMap_.begin(); | 152 extensionMap_.begin(); |
| 137 while (it != extensionMap_.end()) { | 153 while (it != extensionMap_.end()) { |
| 138 HeaderExtension* extension = it->second; | 154 HeaderExtension* extension = it->second; |
| 139 if (extension->active) { | 155 if (extension->active) { |
| 140 length += extension->length; | 156 length += extension->length; |
| 141 } | 157 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 assert(map); | 236 assert(map); |
| 221 std::map<uint8_t, HeaderExtension*>::const_iterator it = | 237 std::map<uint8_t, HeaderExtension*>::const_iterator it = |
| 222 extensionMap_.begin(); | 238 extensionMap_.begin(); |
| 223 while (it != extensionMap_.end()) { | 239 while (it != extensionMap_.end()) { |
| 224 HeaderExtension* extension = it->second; | 240 HeaderExtension* extension = it->second; |
| 225 map->Register(extension->type, it->first, extension->active); | 241 map->Register(extension->type, it->first, extension->active); |
| 226 it++; | 242 it++; |
| 227 } | 243 } |
| 228 } | 244 } |
| 229 } // namespace webrtc | 245 } // namespace webrtc |
| OLD | NEW |