OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 | 224 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 |
225 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 225 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
226 // | ID | len=0 | Content type | | 226 // | ID | len=0 | Content type | |
227 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 227 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
228 constexpr RTPExtensionType VideoContentTypeExtension::kId; | 228 constexpr RTPExtensionType VideoContentTypeExtension::kId; |
229 constexpr uint8_t VideoContentTypeExtension::kValueSizeBytes; | 229 constexpr uint8_t VideoContentTypeExtension::kValueSizeBytes; |
230 constexpr const char* VideoContentTypeExtension::kUri; | 230 constexpr const char* VideoContentTypeExtension::kUri; |
231 | 231 |
232 bool VideoContentTypeExtension::Parse(rtc::ArrayView<const uint8_t> data, | 232 bool VideoContentTypeExtension::Parse(rtc::ArrayView<const uint8_t> data, |
233 VideoContentType* content_type) { | 233 VideoContentType* content_type) { |
234 if (data.size() == 1 && | 234 if (data.size() == 1 && VideoContentType::IsValidContentType(data[0])) { |
sprang_webrtc
2017/07/26 14:13:43
Maybe be lenient when parsing? Mask out the lowest
ilnik
2017/07/26 14:49:48
I think this static one-liner function will be opt
| |
235 data[0] < static_cast<uint8_t>(VideoContentType::TOTAL_CONTENT_TYPES)) { | 235 *content_type = data[0]; |
236 *content_type = static_cast<VideoContentType>(data[0]); | |
237 return true; | 236 return true; |
238 } | 237 } |
239 return false; | 238 return false; |
240 } | 239 } |
241 | 240 |
242 bool VideoContentTypeExtension::Write(uint8_t* data, | 241 bool VideoContentTypeExtension::Write(uint8_t* data, |
243 VideoContentType content_type) { | 242 VideoContentType content_type) { |
244 data[0] = static_cast<uint8_t>(content_type); | 243 data[0] = static_cast<uint8_t>(content_type); |
245 return true; | 244 return true; |
246 } | 245 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 | 373 |
375 size_t RepairedRtpStreamId::ValueSize(const std::string& rsid) { | 374 size_t RepairedRtpStreamId::ValueSize(const std::string& rsid) { |
376 return RtpStreamId::ValueSize(rsid); | 375 return RtpStreamId::ValueSize(rsid); |
377 } | 376 } |
378 | 377 |
379 bool RepairedRtpStreamId::Write(uint8_t* data, const std::string& rsid) { | 378 bool RepairedRtpStreamId::Write(uint8_t* data, const std::string& rsid) { |
380 return RtpStreamId::Write(data, rsid); | 379 return RtpStreamId::Write(data, rsid); |
381 } | 380 } |
382 | 381 |
383 } // namespace webrtc | 382 } // namespace webrtc |
OLD | NEW |