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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 } | 237 } |
238 return false; | 238 return false; |
239 } | 239 } |
240 | 240 |
241 bool VideoContentTypeExtension::Write(uint8_t* data, | 241 bool VideoContentTypeExtension::Write(uint8_t* data, |
242 VideoContentType content_type) { | 242 VideoContentType content_type) { |
243 data[0] = static_cast<uint8_t>(content_type); | 243 data[0] = static_cast<uint8_t>(content_type); |
244 return true; | 244 return true; |
245 } | 245 } |
246 | 246 |
247 // Video Timing. | |
248 // 5 timestamps in milliseconds counted from capture time stored in rtp header: | |
249 // ecode start/finish, packetization complete, pacer exit and reserved for | |
250 // modification by the network modification. | |
251 // 0 1 2 3 | |
252 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 | |
253 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
254 // | ID | len=9 | encode start ms delta | encode finish | | |
255 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
256 // | ms delta | packetizer finish ms delta | pacer exit | | |
257 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
258 // | ms delta | network timestamp ms delta | | | |
259 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
260 | |
sprang_webrtc
2017/05/31 11:12:55
So the empty 8bit block at the end is not a part o
ilnik
2017/05/31 15:17:45
Not part of the extension.
| |
261 constexpr RTPExtensionType VideoTimingExtension::kId; | |
262 constexpr uint8_t VideoTimingExtension::kValueSizeBytes; | |
263 constexpr const char* VideoTimingExtension::kUri; | |
264 | |
265 bool VideoTimingExtension::Parse(rtc::ArrayView<const uint8_t> data, | |
266 VideoTiming* timing) { | |
267 RTC_DCHECK(timing); | |
268 if (data.size() != 10) | |
269 return false; | |
270 timing->encode_start_ms_delta = | |
271 ByteReader<uint16_t, 2>::ReadBigEndian(data.data()); | |
sprang_webrtc
2017/05/31 11:12:55
You don't need the second template parameter here.
ilnik
2017/05/31 15:17:45
Done.
| |
272 timing->encode_finish_ms_delta = ByteReader<uint16_t, 2>::ReadBigEndian( | |
273 data.data() + 2 * VideoTiming::kEncodeFinishIdx); | |
274 timing->packetization_finish_ms_delta = | |
275 ByteReader<uint16_t, 2>::ReadBigEndian( | |
276 data.data() + 2 * VideoTiming::kPacketizationFinishDeltaIdx); | |
277 timing->pacer_exit_ms_delta = ByteReader<uint16_t, 2>::ReadBigEndian( | |
278 data.data() + 2 * VideoTiming::kPacerExitDeltaIdx); | |
279 timing->network_timstamp_ms_delta = ByteReader<uint16_t, 2>::ReadBigEndian( | |
280 data.data() + 2 * VideoTiming::kNetworkTimestampDeltaIdx); | |
281 timing->is_timing_frame = true; | |
282 return true; | |
283 } | |
284 | |
285 bool VideoTimingExtension::Write(uint8_t* data, const VideoTiming& timing) { | |
286 ByteWriter<uint16_t, 2>::WriteBigEndian(data, timing.encode_start_ms_delta); | |
287 ByteWriter<uint16_t, 2>::WriteBigEndian( | |
288 data + 2 * VideoTiming::kEncodeFinishIdx, timing.encode_finish_ms_delta); | |
289 ByteWriter<uint16_t, 2>::WriteBigEndian( | |
290 data + 2 * VideoTiming::kPacketizationFinishDeltaIdx, | |
291 timing.packetization_finish_ms_delta); | |
292 ByteWriter<uint16_t, 2>::WriteBigEndian( | |
293 data + 2 * VideoTiming::kPacerExitDeltaIdx, timing.pacer_exit_ms_delta); | |
294 ByteWriter<uint16_t, 2>::WriteBigEndian( | |
295 data + 2 * VideoTiming::kNetworkTimestampDeltaIdx, 0); // reserved | |
296 return true; | |
297 } | |
298 | |
299 bool VideoTimingExtension::Write(uint8_t* data, | |
300 uint16_t time_delta_ms, | |
301 uint8_t idx) { | |
302 ByteWriter<uint16_t, 2>::WriteBigEndian(data + 2 * idx, time_delta_ms); | |
303 return true; | |
304 } | |
305 | |
247 // RtpStreamId. | 306 // RtpStreamId. |
248 constexpr RTPExtensionType RtpStreamId::kId; | 307 constexpr RTPExtensionType RtpStreamId::kId; |
249 constexpr const char* RtpStreamId::kUri; | 308 constexpr const char* RtpStreamId::kUri; |
250 | 309 |
251 bool RtpStreamId::Parse(rtc::ArrayView<const uint8_t> data, StreamId* rsid) { | 310 bool RtpStreamId::Parse(rtc::ArrayView<const uint8_t> data, StreamId* rsid) { |
252 if (data.empty() || data[0] == 0) // Valid rsid can't be empty. | 311 if (data.empty() || data[0] == 0) // Valid rsid can't be empty. |
253 return false; | 312 return false; |
254 rsid->Set(data); | 313 rsid->Set(data); |
255 RTC_DCHECK(!rsid->empty()); | 314 RTC_DCHECK(!rsid->empty()); |
256 return true; | 315 return true; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 | 365 |
307 size_t RepairedRtpStreamId::ValueSize(const std::string& rsid) { | 366 size_t RepairedRtpStreamId::ValueSize(const std::string& rsid) { |
308 return RtpStreamId::ValueSize(rsid); | 367 return RtpStreamId::ValueSize(rsid); |
309 } | 368 } |
310 | 369 |
311 bool RepairedRtpStreamId::Write(uint8_t* data, const std::string& rsid) { | 370 bool RepairedRtpStreamId::Write(uint8_t* data, const std::string& rsid) { |
312 return RtpStreamId::Write(data, rsid); | 371 return RtpStreamId::Write(data, rsid); |
313 } | 372 } |
314 | 373 |
315 } // namespace webrtc | 374 } // namespace webrtc |
OLD | NEW |