OLD | NEW |
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 const char* const kUri; | 23 static constexpr const char* kUri = |
| 24 "http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"; |
24 | 25 |
25 static bool Parse(const uint8_t* data, uint32_t* time_24bits); | 26 static bool Parse(const uint8_t* data, uint32_t* time_24bits); |
26 static bool Write(uint8_t* data, int64_t time_ms); | 27 static bool Write(uint8_t* data, int64_t time_ms); |
27 | 28 |
28 static constexpr uint32_t MsTo24Bits(int64_t time_ms) { | 29 static constexpr uint32_t MsTo24Bits(int64_t time_ms) { |
29 return static_cast<uint32_t>(((time_ms << 18) + 500) / 1000) & 0x00FFFFFF; | 30 return static_cast<uint32_t>(((time_ms << 18) + 500) / 1000) & 0x00FFFFFF; |
30 } | 31 } |
31 }; | 32 }; |
32 | 33 |
33 class AudioLevel { | 34 class AudioLevel { |
34 public: | 35 public: |
35 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; | 36 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; |
36 static constexpr uint8_t kValueSizeBytes = 1; | 37 static constexpr uint8_t kValueSizeBytes = 1; |
37 static const char* const kUri; | 38 static constexpr const char* kUri = |
| 39 "urn:ietf:params:rtp-hdrext:ssrc-audio-level"; |
38 | 40 |
39 static bool Parse(const uint8_t* data, | 41 static bool Parse(const uint8_t* data, |
40 bool* voice_activity, | 42 bool* voice_activity, |
41 uint8_t* audio_level); | 43 uint8_t* audio_level); |
42 static bool Write(uint8_t* data, bool voice_activity, uint8_t audio_level); | 44 static bool Write(uint8_t* data, bool voice_activity, uint8_t audio_level); |
43 }; | 45 }; |
44 | 46 |
45 class TransmissionOffset { | 47 class TransmissionOffset { |
46 public: | 48 public: |
47 static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset; | 49 static constexpr RTPExtensionType kId = kRtpExtensionTransmissionTimeOffset; |
48 static constexpr uint8_t kValueSizeBytes = 3; | 50 static constexpr uint8_t kValueSizeBytes = 3; |
49 static const char* const kUri; | 51 static constexpr const char* kUri = "urn:ietf:params:rtp-hdrext:toffset"; |
50 | 52 |
51 static bool Parse(const uint8_t* data, int32_t* rtp_time); | 53 static bool Parse(const uint8_t* data, int32_t* rtp_time); |
52 static bool Write(uint8_t* data, int32_t rtp_time); | 54 static bool Write(uint8_t* data, int32_t rtp_time); |
53 }; | 55 }; |
54 | 56 |
55 class TransportSequenceNumber { | 57 class TransportSequenceNumber { |
56 public: | 58 public: |
57 static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber; | 59 static constexpr RTPExtensionType kId = kRtpExtensionTransportSequenceNumber; |
58 static constexpr uint8_t kValueSizeBytes = 2; | 60 static constexpr uint8_t kValueSizeBytes = 2; |
59 static const char* const kUri; | 61 static constexpr const char* kUri = |
60 | 62 "http://www.ietf.org/id/" |
| 63 "draft-holmer-rmcat-transport-wide-cc-extensions-01"; |
61 static bool Parse(const uint8_t* data, uint16_t* value); | 64 static bool Parse(const uint8_t* data, uint16_t* value); |
62 static bool Write(uint8_t* data, uint16_t value); | 65 static bool Write(uint8_t* data, uint16_t value); |
63 }; | 66 }; |
64 | 67 |
65 class VideoOrientation { | 68 class VideoOrientation { |
66 public: | 69 public: |
67 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation; | 70 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation; |
68 static constexpr uint8_t kValueSizeBytes = 1; | 71 static constexpr uint8_t kValueSizeBytes = 1; |
69 static const char* const kUri; | 72 static constexpr const char* kUri = "urn:3gpp:video-orientation"; |
70 | 73 |
71 static bool Parse(const uint8_t* data, VideoRotation* value); | 74 static bool Parse(const uint8_t* data, VideoRotation* value); |
72 static bool Write(uint8_t* data, VideoRotation value); | 75 static bool Write(uint8_t* data, VideoRotation value); |
73 static bool Parse(const uint8_t* data, uint8_t* value); | 76 static bool Parse(const uint8_t* data, uint8_t* value); |
74 static bool Write(uint8_t* data, uint8_t value); | 77 static bool Write(uint8_t* data, uint8_t value); |
75 }; | 78 }; |
76 | 79 |
77 class PlayoutDelayLimits { | 80 class PlayoutDelayLimits { |
78 public: | 81 public: |
79 static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay; | 82 static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay; |
80 static constexpr uint8_t kValueSizeBytes = 3; | 83 static constexpr uint8_t kValueSizeBytes = 3; |
81 static const char* const kUri; | 84 static constexpr const char* kUri = |
| 85 "http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"; |
82 | 86 |
83 // Playout delay in milliseconds. A playout delay limit (min or max) | 87 // Playout delay in milliseconds. A playout delay limit (min or max) |
84 // has 12 bits allocated. This allows a range of 0-4095 values which | 88 // has 12 bits allocated. This allows a range of 0-4095 values which |
85 // translates to a range of 0-40950 in milliseconds. | 89 // translates to a range of 0-40950 in milliseconds. |
86 static constexpr int kGranularityMs = 10; | 90 static constexpr int kGranularityMs = 10; |
87 // Maximum playout delay value in milliseconds. | 91 // Maximum playout delay value in milliseconds. |
88 static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950. | 92 static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950. |
89 | 93 |
90 static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay); | 94 static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay); |
91 static bool Write(uint8_t* data, const PlayoutDelay& playout_delay); | 95 static bool Write(uint8_t* data, const PlayoutDelay& playout_delay); |
92 }; | 96 }; |
93 | 97 |
94 } // namespace webrtc | 98 } // namespace webrtc |
95 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ | 99 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ |
OLD | NEW |