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

Side by Side Diff: webrtc/modules/rtp_rtcp/include/rtp_header_extension_map.h

Issue 3013623002: Fix no_size_t_to_int_warning in rtp_rtcp:rtp_rtcp_format target (Closed)
Patch Set: . Created 3 years, 3 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
(...skipping 11 matching lines...) Expand all
22 namespace webrtc { 22 namespace webrtc {
23 23
24 struct RtpExtensionSize { 24 struct RtpExtensionSize {
25 RTPExtensionType type; 25 RTPExtensionType type;
26 uint8_t value_size; 26 uint8_t value_size;
27 }; 27 };
28 28
29 class RtpHeaderExtensionMap { 29 class RtpHeaderExtensionMap {
30 public: 30 public:
31 static constexpr RTPExtensionType kInvalidType = kRtpExtensionNone; 31 static constexpr RTPExtensionType kInvalidType = kRtpExtensionNone;
32 static constexpr uint8_t kInvalidId = 0; 32 static constexpr int kInvalidId = 0;
33 33
34 RtpHeaderExtensionMap(); 34 RtpHeaderExtensionMap();
35 explicit RtpHeaderExtensionMap(rtc::ArrayView<const RtpExtension> extensions); 35 explicit RtpHeaderExtensionMap(rtc::ArrayView<const RtpExtension> extensions);
36 36
37 template <typename Extension> 37 template <typename Extension>
38 bool Register(uint8_t id) { 38 bool Register(int id) {
39 return Register(id, Extension::kId, Extension::kUri); 39 return Register(id, Extension::kId, Extension::kUri);
40 } 40 }
41 bool RegisterByType(uint8_t id, RTPExtensionType type); 41 bool RegisterByType(int id, RTPExtensionType type);
42 bool RegisterByUri(uint8_t id, const std::string& uri); 42 bool RegisterByUri(int id, const std::string& uri);
43 43
44 bool IsRegistered(RTPExtensionType type) const { 44 bool IsRegistered(RTPExtensionType type) const {
45 return GetId(type) != kInvalidId; 45 return GetId(type) != kInvalidId;
46 } 46 }
47 // Return kInvalidType if not found. 47 // Return kInvalidType if not found.
48 RTPExtensionType GetType(uint8_t id) const { 48 RTPExtensionType GetType(int id) const {
49 RTC_DCHECK_GE(id, kMinId); 49 RTC_DCHECK_GE(id, kMinId);
50 RTC_DCHECK_LE(id, kMaxId); 50 RTC_DCHECK_LE(id, kMaxId);
51 return types_[id]; 51 return types_[id];
52 } 52 }
53 // Return kInvalidId if not found. 53 // Return kInvalidId if not found.
54 uint8_t GetId(RTPExtensionType type) const { 54 uint8_t GetId(RTPExtensionType type) const {
55 RTC_DCHECK_GT(type, kRtpExtensionNone); 55 RTC_DCHECK_GT(type, kRtpExtensionNone);
56 RTC_DCHECK_LT(type, kRtpExtensionNumberOfExtensions); 56 RTC_DCHECK_LT(type, kRtpExtensionNumberOfExtensions);
57 return ids_[type]; 57 return ids_[type];
58 } 58 }
59 59
60 size_t GetTotalLengthInBytes( 60 size_t GetTotalLengthInBytes(
61 rtc::ArrayView<const RtpExtensionSize> extensions) const; 61 rtc::ArrayView<const RtpExtensionSize> extensions) const;
62 62
63 // TODO(danilchap): Remove use of the functions below. 63 // TODO(danilchap): Remove use of the functions below.
64 int32_t Register(RTPExtensionType type, uint8_t id) { 64 int32_t Register(RTPExtensionType type, int id) {
65 return RegisterByType(id, type) ? 0 : -1; 65 return RegisterByType(id, type) ? 0 : -1;
66 } 66 }
67 int32_t Deregister(RTPExtensionType type); 67 int32_t Deregister(RTPExtensionType type);
68 68
69 private: 69 private:
70 static constexpr uint8_t kMinId = 1; 70 static constexpr int kMinId = 1;
71 static constexpr uint8_t kMaxId = 14; 71 static constexpr int kMaxId = 14;
72 bool Register(uint8_t id, RTPExtensionType type, const char* uri); 72 bool Register(int id, RTPExtensionType type, const char* uri);
73 73
74 RTPExtensionType types_[kMaxId + 1]; 74 RTPExtensionType types_[kMaxId + 1];
75 uint8_t ids_[kRtpExtensionNumberOfExtensions]; 75 uint8_t ids_[kRtpExtensionNumberOfExtensions];
76 }; 76 };
77 77
78 } // namespace webrtc 78 } // namespace webrtc
79 79
80 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_EXTENSION_MAP_H_ 80 #endif // WEBRTC_MODULES_RTP_RTCP_INCLUDE_RTP_HEADER_EXTENSION_MAP_H_
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/BUILD.gn ('k') | webrtc/modules/rtp_rtcp/source/rtp_header_extension_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698