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

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

Issue 1539423003: [rtp_rtcp] Lint errors cleaned from rtp_utility (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 12 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_
13 13
14 #include <stddef.h> // size_t, ptrdiff_t
15
16 #include <map> 14 #include <map>
17 15
18 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" 16 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h"
19 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 17 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
20 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h" 18 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extension.h"
21 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h" 19 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_config.h"
22 #include "webrtc/typedefs.h" 20 #include "webrtc/typedefs.h"
23 21
24 namespace webrtc { 22 namespace webrtc {
25 23
26 const uint8_t kRtpMarkerBitMask = 0x80; 24 const uint8_t kRtpMarkerBitMask = 0x80;
27 25
28 RtpData* NullObjectRtpData(); 26 RtpData* NullObjectRtpData();
29 RtpFeedback* NullObjectRtpFeedback(); 27 RtpFeedback* NullObjectRtpFeedback();
30 RtpAudioFeedback* NullObjectRtpAudioFeedback(); 28 RtpAudioFeedback* NullObjectRtpAudioFeedback();
31 ReceiveStatistics* NullObjectReceiveStatistics(); 29 ReceiveStatistics* NullObjectReceiveStatistics();
32 30
33 namespace RtpUtility { 31 namespace RtpUtility {
34 // January 1970, in NTP seconds.
35 const uint32_t NTP_JAN_1970 = 2208988800UL;
36 32
37 // Magic NTP fractional unit. 33 struct Payload {
38 const double NTP_FRAC = 4.294967296E+9; 34 char name[RTP_PAYLOAD_NAME_SIZE];
35 bool audio;
36 PayloadUnion typeSpecific;
37 };
39 38
40 struct Payload 39 typedef std::map<int8_t, Payload*> PayloadTypeMap;
41 {
42 char name[RTP_PAYLOAD_NAME_SIZE];
43 bool audio;
44 PayloadUnion typeSpecific;
45 };
46 40
47 typedef std::map<int8_t, Payload*> PayloadTypeMap; 41 bool StringCompare(const char* str1, const char* str2, const uint32_t length);
48 42
49 uint32_t pow2(uint8_t exp); 43 // Round up to the nearest size that is a multiple of 4.
44 size_t Word32Align(size_t size);
50 45
51 // Returns true if |newTimestamp| is older than |existingTimestamp|. 46 class RtpHeaderParser {
52 // |wrapped| will be set to true if there has been a wraparound between the 47 public:
53 // two timestamps. 48 RtpHeaderParser(const uint8_t* rtpData, size_t rtpDataLength);
54 bool OldTimestamp(uint32_t newTimestamp, 49 ~RtpHeaderParser();
55 uint32_t existingTimestamp,
56 bool* wrapped);
57 50
58 bool StringCompare(const char* str1, 51 bool RTCP() const;
59 const char* str2, 52 bool ParseRtcp(RTPHeader* header) const;
60 const uint32_t length); 53 bool Parse(RTPHeader* parsedPacket,
54 RtpHeaderExtensionMap* ptrExtensionMap = nullptr) const;
61 55
62 // Round up to the nearest size that is a multiple of 4. 56 private:
63 size_t Word32Align(size_t size); 57 void ParseOneByteExtensionHeader(RTPHeader* parsedPacket,
58 const RtpHeaderExtensionMap* ptrExtensionMap,
59 const uint8_t* ptrRTPDataExtensionEnd,
60 const uint8_t* ptr) const;
64 61
65 class RtpHeaderParser { 62 uint8_t ParsePaddingBytes(const uint8_t* ptrRTPDataExtensionEnd,
66 public: 63 const uint8_t* ptr) const;
67 RtpHeaderParser(const uint8_t* rtpData, size_t rtpDataLength);
68 ~RtpHeaderParser();
69 64
70 bool RTCP() const; 65 const uint8_t* const _ptrRTPDataBegin;
71 bool ParseRtcp(RTPHeader* header) const; 66 const uint8_t* const _ptrRTPDataEnd;
72 bool Parse(RTPHeader& parsedPacket, 67 };
73 RtpHeaderExtensionMap* ptrExtensionMap = NULL) const;
74
75 private:
76 void ParseOneByteExtensionHeader(
77 RTPHeader& parsedPacket,
78 const RtpHeaderExtensionMap* ptrExtensionMap,
79 const uint8_t* ptrRTPDataExtensionEnd,
80 const uint8_t* ptr) const;
81
82 uint8_t ParsePaddingBytes(
83 const uint8_t* ptrRTPDataExtensionEnd,
84 const uint8_t* ptr) const;
85
86 const uint8_t* const _ptrRTPDataBegin;
87 const uint8_t* const _ptrRTPDataEnd;
88 };
89 } // namespace RtpUtility 68 } // namespace RtpUtility
90 } // namespace webrtc 69 } // namespace webrtc
91 70
92 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_ 71 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_UTILITY_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_utility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698