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

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

Issue 2484863007: Revert of Simplify and extend RtpHeaderExtensionMap (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/common_video/rotation.h" 14 #include "webrtc/common_video/rotation.h"
15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 15 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
16 16
17 namespace webrtc { 17 namespace webrtc {
18 18
19 class AbsoluteSendTime { 19 class AbsoluteSendTime {
20 public: 20 public:
21 static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime; 21 static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime;
22 static constexpr uint8_t kValueSizeBytes = 3; 22 static constexpr uint8_t kValueSizeBytes = 3;
23 static constexpr const char* kUri = 23 static const char* const kUri;
24 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time";
25 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 constexpr const char* kUri = 37 static const char* const kUri;
39 "urn:ietf:params:rtp-hdrext:ssrc-audio-level";
40 38
41 static bool Parse(const uint8_t* data, 39 static bool Parse(const uint8_t* data,
42 bool* voice_activity, 40 bool* voice_activity,
43 uint8_t* audio_level); 41 uint8_t* audio_level);
44 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);
45 }; 43 };
46 44
47 class TransmissionOffset { 45 class TransmissionOffset {
48 public: 46 public:
49 static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset; 47 static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset;
50 static constexpr uint8_t kValueSizeBytes = 3; 48 static constexpr uint8_t kValueSizeBytes = 3;
51 static constexpr const char* kUri = "urn:ietf:params:rtp-hdrext:toffset"; 49 static const char* const kUri;
52 50
53 static bool Parse(const uint8_t* data, int32_t* rtp_time); 51 static bool Parse(const uint8_t* data, int32_t* rtp_time);
54 static bool Write(uint8_t* data, int32_t rtp_time); 52 static bool Write(uint8_t* data, int32_t rtp_time);
55 }; 53 };
56 54
57 class TransportSequenceNumber { 55 class TransportSequenceNumber {
58 public: 56 public:
59 static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber; 57 static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber;
60 static constexpr uint8_t kValueSizeBytes = 2; 58 static constexpr uint8_t kValueSizeBytes = 2;
61 static constexpr const char* kUri = 59 static const char* const kUri;
62 "http://www.ietf.org/id/" 60
63 "draft-holmer-rmcat-transport-wide-cc-extensions-01";
64 static bool Parse(const uint8_t* data, uint16_t* value); 61 static bool Parse(const uint8_t* data, uint16_t* value);
65 static bool Write(uint8_t* data, uint16_t value); 62 static bool Write(uint8_t* data, uint16_t value);
66 }; 63 };
67 64
68 class VideoOrientation { 65 class VideoOrientation {
69 public: 66 public:
70 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation; 67 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation;
71 static constexpr uint8_t kValueSizeBytes = 1; 68 static constexpr uint8_t kValueSizeBytes = 1;
72 static constexpr const char* kUri = "urn:3gpp:video-orientation"; 69 static const char* const kUri;
73 70
74 static bool Parse(const uint8_t* data, VideoRotation* value); 71 static bool Parse(const uint8_t* data, VideoRotation* value);
75 static bool Write(uint8_t* data, VideoRotation value); 72 static bool Write(uint8_t* data, VideoRotation value);
76 static bool Parse(const uint8_t* data, uint8_t* value); 73 static bool Parse(const uint8_t* data, uint8_t* value);
77 static bool Write(uint8_t* data, uint8_t value); 74 static bool Write(uint8_t* data, uint8_t value);
78 }; 75 };
79 76
80 class PlayoutDelayLimits { 77 class PlayoutDelayLimits {
81 public: 78 public:
82 static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay; 79 static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay;
83 static constexpr uint8_t kValueSizeBytes = 3; 80 static constexpr uint8_t kValueSizeBytes = 3;
84 static constexpr const char* kUri = 81 static const char* const kUri;
85 "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay";
86 82
87 // Playout delay in milliseconds. A playout delay limit (min or max) 83 // Playout delay in milliseconds. A playout delay limit (min or max)
88 // 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
89 // translates to a range of 0-40950 in milliseconds. 85 // translates to a range of 0-40950 in milliseconds.
90 static constexpr int kGranularityMs = 10; 86 static constexpr int kGranularityMs = 10;
91 // Maximum playout delay value in milliseconds. 87 // Maximum playout delay value in milliseconds.
92 static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950. 88 static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950.
93 89
94 static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay); 90 static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay);
95 static bool Write(uint8_t* data, const PlayoutDelay& playout_delay); 91 static bool Write(uint8_t* data, const PlayoutDelay& playout_delay);
96 }; 92 };
97 93
98 } // namespace webrtc 94 } // namespace webrtc
99 #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