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/call.h" | 14 #include "webrtc/call.h" |
15 #include "webrtc/common_video/rotation.h" | 15 #include "webrtc/common_video/rotation.h" |
16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" | 16 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 | 19 |
20 class AbsoluteSendTime { | 20 class AbsoluteSendTime { |
21 public: | 21 public: |
22 static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime; | 22 static constexpr RTPExtensionType kId = kRtpExtensionAbsoluteSendTime; |
23 static constexpr uint8_t kValueSizeBytes = 3; | 23 static constexpr uint8_t kValueSizeBytes = 3; |
24 static const char* kName; | 24 static const char* kName; |
25 static bool IsSupportedFor(MediaType type); | 25 static bool IsSupportedFor(MediaType type); |
26 static bool Parse(const uint8_t* data, uint32_t* time_24bits); | 26 static bool Parse(const uint8_t* data, uint32_t* time_ms); |
27 static bool Write(uint8_t* data, int64_t time_ms); | 27 static bool Write(uint8_t* data, int64_t time_ms); |
28 | |
29 static constexpr uint32_t MsTo24Bits(int64_t time_ms) { | |
30 return static_cast<uint32_t>(((time_ms << 18) + 500) / 1000) & 0x00FFFFFF; | |
31 } | |
32 }; | 28 }; |
33 | 29 |
34 class AudioLevel { | 30 class AudioLevel { |
35 public: | 31 public: |
36 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; | 32 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; |
37 static constexpr uint8_t kValueSizeBytes = 1; | 33 static constexpr uint8_t kValueSizeBytes = 1; |
38 static const char* kName; | 34 static const char* kName; |
39 static bool IsSupportedFor(MediaType type); | 35 static bool IsSupportedFor(MediaType type); |
40 static bool Parse(const uint8_t* data, | 36 static bool Parse(const uint8_t* data, |
41 bool* voice_activity, | 37 bool* voice_activity, |
(...skipping 26 matching lines...) Expand all Loading... |
68 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation; | 64 static constexpr RTPExtensionType kId = kRtpExtensionVideoRotation; |
69 static constexpr uint8_t kValueSizeBytes = 1; | 65 static constexpr uint8_t kValueSizeBytes = 1; |
70 static const char* kName; | 66 static const char* kName; |
71 static bool IsSupportedFor(MediaType type); | 67 static bool IsSupportedFor(MediaType type); |
72 static bool Parse(const uint8_t* data, VideoRotation* value); | 68 static bool Parse(const uint8_t* data, VideoRotation* value); |
73 static bool Write(uint8_t* data, VideoRotation value); | 69 static bool Write(uint8_t* data, VideoRotation value); |
74 static bool Parse(const uint8_t* data, uint8_t* value); | 70 static bool Parse(const uint8_t* data, uint8_t* value); |
75 static bool Write(uint8_t* data, uint8_t value); | 71 static bool Write(uint8_t* data, uint8_t value); |
76 }; | 72 }; |
77 | 73 |
| 74 class PlayoutDelayLimits { |
| 75 public: |
| 76 static constexpr RTPExtensionType kId = kRtpExtensionPlayoutDelay; |
| 77 static constexpr uint8_t kValueSizeBytes = 3; |
| 78 static const char* kName; |
| 79 static bool IsSupportedFor(MediaType type); |
| 80 // Playout delay in milliseconds. A playout delay limit (min or max) |
| 81 // has 12 bits allocated. This allows a range of 0-4095 values which |
| 82 // translates to a range of 0-40950 in milliseconds. |
| 83 static constexpr int kGranularityMs = 10; |
| 84 // Maximum playout delay value in milliseconds. |
| 85 static constexpr int kMaxMs = 0xfff * kGranularityMs; // 40950. |
| 86 |
| 87 static bool Parse(const uint8_t* data, PlayoutDelay* playout_delay); |
| 88 static bool Write(uint8_t* data, const PlayoutDelay& playout_delay); |
| 89 }; |
| 90 |
78 } // namespace webrtc | 91 } // namespace webrtc |
79 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ | 92 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ |
OLD | NEW |