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

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

Issue 2457783005: Style cleanups in rtp header extension traits: (Closed)
Patch Set: Created 4 years, 1 month 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) 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ 10 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_
11 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ 11 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_
12 12
13 #include "webrtc/base/basictypes.h" 13 #include "webrtc/base/basictypes.h"
14 #include "webrtc/call.h"
15 #include "webrtc/common_video/rotation.h" 14 #include "webrtc/common_video/rotation.h"
16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
17 16
18 namespace webrtc { 17 namespace webrtc {
19 18
20 class AbsoluteSendTime { 19 class AbsoluteSendTime {
21 public: 20 public:
22 static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime; 21 static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime;
23 static constexpr uint8_t kValueSizeBytes = 3; 22 static constexpr uint8_t kValueSizeBytes = 3;
24 static const char* kName; 23 static const char* const kUri;
25 static bool IsSupportedFor(MediaType type); 24
26 static bool Parse(const uint8_t* data, uint32_t* time_24bits); 25 static bool Parse(const uint8_t* data, uint32_t* time_24bits);
27 static bool Write(uint8_t* data, int64_t time_ms); 26 static bool Write(uint8_t* data, int64_t time_ms);
28 27
29 static constexpr uint32_t MsTo24Bits(int64_t time_ms) { 28 static constexpr uint32_t MsTo24Bits(int64_t time_ms) {
30 return static_cast<uint32_t>(((time_ms << 18) + 500) / 1000) & 0x00FFFFFF; 29 return static_cast<uint32_t>(((time_ms << 18) + 500) / 1000) & 0x00FFFFFF;
31 } 30 }
32 }; 31 };
33 32
34 class AudioLevel { 33 class AudioLevel {
35 public: 34 public:
36 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; 35 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel;
37 static constexpr uint8_t kValueSizeBytes = 1; 36 static constexpr uint8_t kValueSizeBytes = 1;
38 static const char* kName; 37 static const char* const kUri;
39 static bool IsSupportedFor(MediaType type); 38
40 static bool Parse(const uint8_t* data, 39 static bool Parse(const uint8_t* data,
41 bool* voice_activity, 40 bool* voice_activity,
42 uint8_t* audio_level); 41 uint8_t* audio_level);
43 static bool Write(uint8_t* data, bool voice_activity, uint8_t audio_level); 42 static bool Write(uint8_t* data, bool voice_activity, uint8_t audio_level);
44 }; 43 };
45 44
46 class TransmissionOffset { 45 class TransmissionOffset {
47 public: 46 public:
48 static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset; 47 static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset;
49 static constexpr uint8_t kValueSizeBytes = 3; 48 static constexpr uint8_t kValueSizeBytes = 3;
50 static const char* kName; 49 static const char* const kUri;
51 static bool IsSupportedFor(MediaType type); 50
52 static bool Parse(const uint8_t* data, int32_t* rtp_time); 51 static bool Parse(const uint8_t* data, int32_t* rtp_time);
53 static bool Write(uint8_t* data, int32_t rtp_time); 52 static bool Write(uint8_t* data, int32_t rtp_time);
54 }; 53 };
55 54
56 class TransportSequenceNumber { 55 class TransportSequenceNumber {
57 public: 56 public:
58 static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber; 57 static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber;
59 static constexpr uint8_t kValueSizeBytes = 2; 58 static constexpr uint8_t kValueSizeBytes = 2;
60 static const char* kName; 59 static const char* const kUri;
61 static bool IsSupportedFor(MediaType type); 60
62 static bool Parse(const uint8_t* data, uint16_t* value); 61 static bool Parse(const uint8_t* data, uint16_t* value);
63 static bool Write(uint8_t* data, uint16_t value); 62 static bool Write(uint8_t* data, uint16_t value);
64 }; 63 };
65 64
66 class VideoOrientation { 65 class VideoOrientation {
67 public: 66 public:
68 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation; 67 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation;
69 static constexpr uint8_t kValueSizeBytes = 1; 68 static constexpr uint8_t kValueSizeBytes = 1;
70 static const char* kName; 69 static const char* const kUri;
71 static bool IsSupportedFor(MediaType type); 70
72 static bool Parse(const uint8_t* data, VideoRotation* value); 71 static bool Parse(const uint8_t* data, VideoRotation* value);
73 static bool Write(uint8_t* data, VideoRotation value); 72 static bool Write(uint8_t* data, VideoRotation value);
74 static bool Parse(const uint8_t* data, uint8_t* value); 73 static bool Parse(const uint8_t* data, uint8_t* value);
75 static bool Write(uint8_t* data, uint8_t value); 74 static bool Write(uint8_t* data, uint8_t value);
76 }; 75 };
77 76
78 class PlayoutDelayLimits { 77 class PlayoutDelayLimits {
79 public: 78 public:
80 static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay; 79 static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay;
81 static constexpr uint8_t kValueSizeBytes = 3; 80 static constexpr uint8_t kValueSizeBytes = 3;
82 static const char* kName; 81 static const char* const kUri;
83 static bool IsSupportedFor(MediaType type); 82
84 // Playout delay in milliseconds. A playout delay limit (min or max) 83 // Playout delay in milliseconds. A playout delay limit (min or max)
85 // has 12 bits allocated. This allows a range of 0-4095 values which 84 // has 12 bits allocated. This allows a range of 0-4095 values which
86 // translates to a range of 0-40950 in milliseconds. 85 // translates to a range of 0-40950 in milliseconds.
87 static constexpr int kGranularityMs = 10; 86 static constexpr int kGranularityMs = 10;
88 // Maximum playout delay value in milliseconds. 87 // Maximum playout delay value in milliseconds.
89 static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950. 88 static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950.
90 89
91 static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay); 90 static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay);
92 static bool Write(uint8_t* data, const PlayoutDelay& playout_delay); 91 static bool Write(uint8_t* data, const PlayoutDelay& playout_delay);
93 }; 92 };
94 93
95 } // namespace webrtc 94 } // namespace webrtc
96 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ 95 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698