Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_utility.cc

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Fix uninitialized variables memcheck errors Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
12 12
13 #include <string.h>
14
15 #include "webrtc/base/logging.h" 13 #include "webrtc/base/logging.h"
16 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" 14 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
17 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 15 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
18 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" 16 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
19 17
20 namespace webrtc { 18 namespace webrtc {
21 19
22 RtpData* NullObjectRtpData() { 20 RtpData* NullObjectRtpData() {
23 static NullRtpData null_rtp_data; 21 static NullRtpData null_rtp_data;
24 return &null_rtp_data; 22 return &null_rtp_data;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 header->extension.videoRotation = kVideoRotation_0; 249 header->extension.videoRotation = kVideoRotation_0;
252 250
253 // May not be present in packet. 251 // May not be present in packet.
254 header->extension.playout_delay.min_ms = -1; 252 header->extension.playout_delay.min_ms = -1;
255 header->extension.playout_delay.max_ms = -1; 253 header->extension.playout_delay.max_ms = -1;
256 254
257 // May not be present in packet. 255 // May not be present in packet.
258 header->extension.hasVideoContentType = false; 256 header->extension.hasVideoContentType = false;
259 header->extension.videoContentType = VideoContentType::UNSPECIFIED; 257 header->extension.videoContentType = VideoContentType::UNSPECIFIED;
260 258
259 header->extension.hasVideoTiming = false;
260 header->extension.videoTiming = {0u, 0u, 0u, 0u, 0u, false};
261
261 if (X) { 262 if (X) {
262 /* RTP header extension, RFC 3550. 263 /* RTP header extension, RFC 3550.
263 0 1 2 3 264 0 1 2 3
264 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 265 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
265 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 266 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
266 | defined by profile | length | 267 | defined by profile | length |
267 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 268 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
268 | header extension | 269 | header extension |
269 | .... | 270 | .... |
270 */ 271 */
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 463 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
463 464
464 if (ptr[0] < 465 if (ptr[0] <
465 static_cast<uint8_t>(VideoContentType::TOTAL_CONTENT_TYPES)) { 466 static_cast<uint8_t>(VideoContentType::TOTAL_CONTENT_TYPES)) {
466 header->extension.hasVideoContentType = true; 467 header->extension.hasVideoContentType = true;
467 header->extension.videoContentType = 468 header->extension.videoContentType =
468 static_cast<VideoContentType>(ptr[0]); 469 static_cast<VideoContentType>(ptr[0]);
469 } 470 }
470 break; 471 break;
471 } 472 }
473 case kRtpExtensionVideoTiming: {
474 if (len != 9) {
475 LOG(LS_WARNING) << "Incorrect video timing len: " << len;
476 return;
477 }
478 // 0 1 2 3
479 // 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
480 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
481 // | ID | len=9 | encode start ms delta | encode finish |
482 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
483 // | ms delta | packetizer finish ms delta | pacer exit |
484 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
485 // | ms delta | network timestamp ms delta | |
486 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
487 header->extension.hasVideoTiming = true;
488 header->extension.videoTiming.encode_start_ms_delta =
489 ByteReader<uint16_t, 2>::ReadBigEndian(ptr);
490 header->extension.videoTiming.encode_finish_ms_delta =
491 ByteReader<uint16_t, 2>::ReadBigEndian(ptr + 2);
492 header->extension.videoTiming.packetization_finish_ms_delta =
493 ByteReader<uint16_t, 2>::ReadBigEndian(ptr + 4);
494 header->extension.videoTiming.pacer_exit_ms_delta =
495 ByteReader<uint16_t, 2>::ReadBigEndian(ptr + 6);
496 header->extension.videoTiming.network_timstamp_ms_delta =
497 ByteReader<uint16_t, 2>::ReadBigEndian(ptr + 8);
498 break;
499 }
sprang_webrtc 2017/05/31 11:12:55 Wouldn't it be possible to wrap |ptr| in an ArrayV
ilnik 2017/05/31 15:17:45 Done.
472 case kRtpExtensionRtpStreamId: { 500 case kRtpExtensionRtpStreamId: {
473 header->extension.stream_id.Set(rtc::MakeArrayView(ptr, len + 1)); 501 header->extension.stream_id.Set(rtc::MakeArrayView(ptr, len + 1));
474 break; 502 break;
475 } 503 }
476 case kRtpExtensionRepairedRtpStreamId: { 504 case kRtpExtensionRepairedRtpStreamId: {
477 header->extension.repaired_stream_id.Set( 505 header->extension.repaired_stream_id.Set(
478 rtc::MakeArrayView(ptr, len + 1)); 506 rtc::MakeArrayView(ptr, len + 1));
479 break; 507 break;
480 } 508 }
481 case kRtpExtensionNone: 509 case kRtpExtensionNone:
482 case kRtpExtensionNumberOfExtensions: { 510 case kRtpExtensionNumberOfExtensions: {
483 RTC_NOTREACHED() << "Invalid extension type: " << type; 511 RTC_NOTREACHED() << "Invalid extension type: " << type;
484 return; 512 return;
485 } 513 }
486 } 514 }
487 } 515 }
488 ptr += (len + 1); 516 ptr += (len + 1);
489 } 517 }
490 } 518 }
491 519
492 } // namespace RtpUtility 520 } // namespace RtpUtility
493 } // namespace webrtc 521 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698