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

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

Issue 2431253003: Remove now unused code in RtpHeaderExtensionMap (Closed)
Patch Set: Created 4 years, 2 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
(...skipping 19 matching lines...) Expand all
30 30
31 // Playout delay in milliseconds. A playout delay limit (min or max) 31 // Playout delay in milliseconds. A playout delay limit (min or max)
32 // has 12 bits allocated. This allows a range of 0-4095 values which translates 32 // has 12 bits allocated. This allows a range of 0-4095 values which translates
33 // to a range of 0-40950 in milliseconds. 33 // to a range of 0-40950 in milliseconds.
34 const int kPlayoutDelayGranularityMs = 10; 34 const int kPlayoutDelayGranularityMs = 10;
35 // Maximum playout delay value in milliseconds. 35 // Maximum playout delay value in milliseconds.
36 const int kPlayoutDelayMaxMs = 40950; 36 const int kPlayoutDelayMaxMs = 40950;
37 37
38 struct HeaderExtension { 38 struct HeaderExtension {
39 explicit HeaderExtension(RTPExtensionType extension_type) 39 explicit HeaderExtension(RTPExtensionType extension_type)
40 : type(extension_type), length(0), active(true) { 40 : type(extension_type), length(0) {
41 Init(); 41 Init();
42 } 42 }
43 43
44 HeaderExtension(RTPExtensionType extension_type, bool active)
45 : type(extension_type), length(0), active(active) {
46 Init();
47 }
48
49 void Init() { 44 void Init() {
50 // TODO(solenberg): Create handler classes for header extensions so we can 45 // TODO(solenberg): Create handler classes for header extensions so we can
51 // get rid of switches like these as well as handling code spread out all 46 // get rid of switches like these as well as handling code spread out all
52 // over. 47 // over.
53 switch (type) { 48 switch (type) {
54 case kRtpExtensionTransmissionTimeOffset: 49 case kRtpExtensionTransmissionTimeOffset:
55 length = kTransmissionTimeOffsetLength; 50 length = kTransmissionTimeOffsetLength;
56 break; 51 break;
57 case kRtpExtensionAudioLevel: 52 case kRtpExtensionAudioLevel:
58 length = kAudioLevelLength; 53 length = kAudioLevelLength;
(...skipping 10 matching lines...) Expand all
69 case kRtpExtensionPlayoutDelay: 64 case kRtpExtensionPlayoutDelay:
70 length = kPlayoutDelayLength; 65 length = kPlayoutDelayLength;
71 break; 66 break;
72 default: 67 default:
73 assert(false); 68 assert(false);
74 } 69 }
75 } 70 }
76 71
77 const RTPExtensionType type; 72 const RTPExtensionType type;
78 uint8_t length; 73 uint8_t length;
79 bool active;
80 }; 74 };
81 75
82 class RtpHeaderExtensionMap { 76 class RtpHeaderExtensionMap {
83 public: 77 public:
84 static constexpr RTPExtensionType kInvalidType = kRtpExtensionNone; 78 static constexpr RTPExtensionType kInvalidType = kRtpExtensionNone;
85 static constexpr uint8_t kInvalidId = 0; 79 static constexpr uint8_t kInvalidId = 0;
86 RtpHeaderExtensionMap(); 80 RtpHeaderExtensionMap();
87 ~RtpHeaderExtensionMap(); 81 ~RtpHeaderExtensionMap();
88 82
89 void Erase(); 83 void Erase();
90 84
91 int32_t Register(const RTPExtensionType type, const uint8_t id); 85 int32_t Register(RTPExtensionType type, uint8_t id);
92 86
93 // Active on an extension indicates whether it is currently being added on 87 int32_t Deregister(RTPExtensionType type);
94 // on the RTP packets. The active/inactive status on an extension can change
95 // dynamically depending on the need to convey new information.
96 int32_t RegisterInactive(const RTPExtensionType type, const uint8_t id);
97 bool SetActive(const RTPExtensionType type, bool active);
98
99 int32_t Deregister(const RTPExtensionType type);
100 88
101 bool IsRegistered(RTPExtensionType type) const; 89 bool IsRegistered(RTPExtensionType type) const;
102 90
103 int32_t GetType(const uint8_t id, RTPExtensionType* type) const; 91 int32_t GetType(uint8_t id, RTPExtensionType* type) const;
104 // Return kInvalidType if not found. 92 // Return kInvalidType if not found.
105 RTPExtensionType GetType(uint8_t id) const; 93 RTPExtensionType GetType(uint8_t id) const;
106 94
107 int32_t GetId(const RTPExtensionType type, uint8_t* id) const; 95 int32_t GetId(const RTPExtensionType type, uint8_t* id) const;
108 // Return kInvalidId if not found. 96 // Return kInvalidId if not found.
109 uint8_t GetId(RTPExtensionType type) const; 97 uint8_t GetId(RTPExtensionType type) const;
110
111 //
112 // Methods below ignore any inactive rtp header extensions.
113 //
114
115 size_t GetTotalLengthInBytes() const; 98 size_t GetTotalLengthInBytes() const;
116 99
117 int32_t GetLengthUntilBlockStartInBytes(const RTPExtensionType type) const;
118
119 void GetCopy(RtpHeaderExtensionMap* map) const; 100 void GetCopy(RtpHeaderExtensionMap* map) const;
120 101
121 int32_t Size() const; 102 int32_t Size() const;
122 103
123 RTPExtensionType First() const;
124
125 RTPExtensionType Next(RTPExtensionType type) const;
126
127 private: 104 private:
128 int32_t Register(const RTPExtensionType type, const uint8_t id, bool active);
129 std::map<uint8_t, HeaderExtension*> extensionMap_; 105 std::map<uint8_t, HeaderExtension*> extensionMap_;
130 }; 106 };
131 } // namespace webrtc 107 } // namespace webrtc
132 108
133 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_ 109 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_
134 110
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698