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

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

Issue 2007743003: Add sender controlled playout delay limits (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cleanup_rtp_hdr_extensions
Patch Set: Rename OnReceivedRtcpReport to OnReceivedRtcpReportBlocks Created 4 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 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_ 11 #ifndef WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_
12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_ 12 #define WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_
13 13
14 #include <map> 14 #include <map>
15 15
16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
17 #include "webrtc/typedefs.h" 17 #include "webrtc/typedefs.h"
18 18
19 namespace webrtc { 19 namespace webrtc {
20 20
21 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE; 21 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE;
22 22
23 const size_t kRtpOneByteHeaderLength = 4; 23 const size_t kRtpOneByteHeaderLength = 4;
24 const size_t kTransmissionTimeOffsetLength = 4; 24 const size_t kTransmissionTimeOffsetLength = 4;
25 const size_t kAudioLevelLength = 2; 25 const size_t kAudioLevelLength = 2;
26 const size_t kAbsoluteSendTimeLength = 4; 26 const size_t kAbsoluteSendTimeLength = 4;
27 const size_t kVideoRotationLength = 2; 27 const size_t kVideoRotationLength = 2;
28 const size_t kTransportSequenceNumberLength = 3; 28 const size_t kTransportSequenceNumberLength = 3;
29 const size_t kPlayoutDelayLength = 4;
30
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
33 // to a range of 0-40950 in milliseconds.
34 const int kPlayoutDelayGranularityMs = 10;
35 // Maximum playout delay value in milliseconds.
36 const int kPlayoutDelayMaxMs = 40950;
29 37
30 struct HeaderExtension { 38 struct HeaderExtension {
31 explicit HeaderExtension(RTPExtensionType extension_type) 39 explicit HeaderExtension(RTPExtensionType extension_type)
32 : type(extension_type), length(0), active(true) { 40 : type(extension_type), length(0), active(true) {
33 Init(); 41 Init();
34 } 42 }
35 43
36 HeaderExtension(RTPExtensionType extension_type, bool active) 44 HeaderExtension(RTPExtensionType extension_type, bool active)
37 : type(extension_type), length(0), active(active) { 45 : type(extension_type), length(0), active(active) {
38 Init(); 46 Init();
(...skipping 12 matching lines...) Expand all
51 break; 59 break;
52 case kRtpExtensionAbsoluteSendTime: 60 case kRtpExtensionAbsoluteSendTime:
53 length = kAbsoluteSendTimeLength; 61 length = kAbsoluteSendTimeLength;
54 break; 62 break;
55 case kRtpExtensionVideoRotation: 63 case kRtpExtensionVideoRotation:
56 length = kVideoRotationLength; 64 length = kVideoRotationLength;
57 break; 65 break;
58 case kRtpExtensionTransportSequenceNumber: 66 case kRtpExtensionTransportSequenceNumber:
59 length = kTransportSequenceNumberLength; 67 length = kTransportSequenceNumberLength;
60 break; 68 break;
69 case kRtpExtensionPlayoutDelay:
70 length = kPlayoutDelayLength;
71 break;
61 default: 72 default:
62 assert(false); 73 assert(false);
63 } 74 }
64 } 75 }
65 76
66 const RTPExtensionType type; 77 const RTPExtensionType type;
67 uint8_t length; 78 uint8_t length;
68 bool active; 79 bool active;
69 }; 80 };
70 81
71 class RtpHeaderExtensionMap { 82 class RtpHeaderExtensionMap {
72 public: 83 public:
73 static constexpr RTPExtensionType kInvalidType = kRtpExtensionNone; 84 static constexpr RTPExtensionType kInvalidType = kRtpExtensionNone;
74 static constexpr uint8_t kInvalidId = 0; 85 static constexpr uint8_t kInvalidId = 0;
75 RtpHeaderExtensionMap(); 86 RtpHeaderExtensionMap();
76 ~RtpHeaderExtensionMap(); 87 ~RtpHeaderExtensionMap();
77 88
78 void Erase(); 89 void Erase();
79 90
80 int32_t Register(const RTPExtensionType type, const uint8_t id); 91 int32_t Register(const RTPExtensionType type, const uint8_t id);
81 92
82 // Active is a concept for a registered rtp header extension which doesn't 93 // Active on an extension indicates whether it is currently being added on
83 // take effect yet until being activated. Inactive RTP header extensions do 94 // on the RTP packets. The active/inactive status on an extension can change
84 // not take effect and should not be included in size calculations until they 95 // dynamically depending on the need to convey new information.
85 // are activated.
86 int32_t RegisterInactive(const RTPExtensionType type, const uint8_t id); 96 int32_t RegisterInactive(const RTPExtensionType type, const uint8_t id);
87 bool SetActive(const RTPExtensionType type, bool active); 97 bool SetActive(const RTPExtensionType type, bool active);
88 98
89 int32_t Deregister(const RTPExtensionType type); 99 int32_t Deregister(const RTPExtensionType type);
90 100
91 bool IsRegistered(RTPExtensionType type) const; 101 bool IsRegistered(RTPExtensionType type) const;
92 102
93 int32_t GetType(const uint8_t id, RTPExtensionType* type) const; 103 int32_t GetType(const uint8_t id, RTPExtensionType* type) const;
94 // Return kInvalidType if not found. 104 // Return kInvalidType if not found.
95 RTPExtensionType GetType(uint8_t id) const; 105 RTPExtensionType GetType(uint8_t id) const;
(...skipping 19 matching lines...) Expand all
115 RTPExtensionType Next(RTPExtensionType type) const; 125 RTPExtensionType Next(RTPExtensionType type) const;
116 126
117 private: 127 private:
118 int32_t Register(const RTPExtensionType type, const uint8_t id, bool active); 128 int32_t Register(const RTPExtensionType type, const uint8_t id, bool active);
119 std::map<uint8_t, HeaderExtension*> extensionMap_; 129 std::map<uint8_t, HeaderExtension*> extensionMap_;
120 }; 130 };
121 } // namespace webrtc 131 } // namespace webrtc
122 132
123 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_ 133 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSION_H_
124 134
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698