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_ms); | 26 static bool Parse(const uint8_t* data, uint32_t* raw_value); |
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 } |
28 }; | 32 }; |
29 | 33 |
30 class AudioLevel { | 34 class AudioLevel { |
31 public: | 35 public: |
32 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; | 36 static constexpr RTPExtensionType kId = kRtpExtensionAudioLevel; |
33 static constexpr uint8_t kValueSizeBytes = 1; | 37 static constexpr uint8_t kValueSizeBytes = 1; |
34 static const char* kName; | 38 static const char* kName; |
35 static bool IsSupportedFor(MediaType type); | 39 static bool IsSupportedFor(MediaType type); |
36 static bool Parse(const uint8_t* data, | 40 static bool Parse(const uint8_t* data, |
37 bool* voice_activity, | 41 bool* voice_activity, |
(...skipping 28 matching lines...) Expand all Loading... |
66 static const char* kName; | 70 static const char* kName; |
67 static bool IsSupportedFor(MediaType type); | 71 static bool IsSupportedFor(MediaType type); |
68 static bool Parse(const uint8_t* data, VideoRotation* value); | 72 static bool Parse(const uint8_t* data, VideoRotation* value); |
69 static bool Write(uint8_t* data, VideoRotation value); | 73 static bool Write(uint8_t* data, VideoRotation value); |
70 static bool Parse(const uint8_t* data, uint8_t* value); | 74 static bool Parse(const uint8_t* data, uint8_t* value); |
71 static bool Write(uint8_t* data, uint8_t value); | 75 static bool Write(uint8_t* data, uint8_t value); |
72 }; | 76 }; |
73 | 77 |
74 } // namespace webrtc | 78 } // namespace webrtc |
75 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ | 79 #endif // WEBRTC_MODULES_RTP_RTCP_SOURCE_RTP_HEADER_EXTENSIONS_H_ |
OLD | NEW |