Chromium Code Reviews| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 RTC_DCHECK_LE(0, playout_delay.min_ms); | 208 RTC_DCHECK_LE(0, playout_delay.min_ms); |
| 209 RTC_DCHECK_LE(playout_delay.min_ms, playout_delay.max_ms); | 209 RTC_DCHECK_LE(playout_delay.min_ms, playout_delay.max_ms); |
| 210 RTC_DCHECK_LE(playout_delay.max_ms, kMaxMs); | 210 RTC_DCHECK_LE(playout_delay.max_ms, kMaxMs); |
| 211 // Convert MS to value to be sent on extension header. | 211 // Convert MS to value to be sent on extension header. |
| 212 uint32_t min_delay = playout_delay.min_ms / kGranularityMs; | 212 uint32_t min_delay = playout_delay.min_ms / kGranularityMs; |
| 213 uint32_t max_delay = playout_delay.max_ms / kGranularityMs; | 213 uint32_t max_delay = playout_delay.max_ms / kGranularityMs; |
| 214 ByteWriter<uint32_t, 3>::WriteBigEndian(data, (min_delay << 12) | max_delay); | 214 ByteWriter<uint32_t, 3>::WriteBigEndian(data, (min_delay << 12) | max_delay); |
| 215 return true; | 215 return true; |
| 216 } | 216 } |
| 217 | 217 |
| 218 // Video Content Type. | |
| 219 // | |
| 220 // E.g. default video or screenshare. | |
| 221 // | |
| 222 // 0 1 | |
| 223 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 | |
| 224 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 225 // | ID | len=0 | Content type | | |
| 226 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 227 constexpr RTPExtensionType VideoContentTypeExtension::kId; | |
| 228 constexpr uint8_t VideoContentTypeExtension::kValueSizeBytes; | |
| 229 constexpr const char* VideoContentTypeExtension::kUri; | |
| 230 | |
| 231 bool VideoContentTypeExtension::Parse(rtc::ArrayView<const uint8_t> data, | |
| 232 VideoContentType* content_type) { | |
| 233 if (data.size() == 1 && | |
| 234 data[0] < static_cast<uint8_t>(VideoContentType::kTotalContentTypes)) { | |
| 235 *content_type = static_cast<VideoContentType>(data[0]); | |
| 236 return true; | |
| 237 } else { | |
|
tommi
2017/04/10 10:59:18
no need for |else|
ilnik
2017/04/10 12:47:42
Done.
| |
| 238 return false; | |
| 239 } | |
| 240 } | |
| 241 | |
| 242 bool VideoContentTypeExtension::Write(uint8_t* data, | |
| 243 VideoContentType content_type) { | |
| 244 data[0] = static_cast<uint8_t>(content_type); | |
|
tommi
2017/04/10 10:59:18
is there a safe cast method that we can use instea
ilnik
2017/04/10 12:47:42
I don't want to write one, as it will introduce a
| |
| 245 return true; | |
| 246 } | |
| 247 | |
| 218 } // namespace webrtc | 248 } // namespace webrtc |
| OLD | NEW |