OLD | NEW |
---|---|
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 |
11 #include "webrtc/common_types.h" | 11 #include "webrtc/common_types.h" |
12 | 12 |
13 #include <string.h> | |
13 #include <limits> | 14 #include <limits> |
14 #include <string.h> | 15 #include <type_traits> |
15 | 16 |
16 #include "webrtc/base/checks.h" | 17 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/stringutils.h" | 18 #include "webrtc/base/stringutils.h" |
18 | 19 |
19 namespace webrtc { | 20 namespace webrtc { |
20 | 21 |
21 StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {} | 22 StreamDataCounters::StreamDataCounters() : first_packet_time_ms(-1) {} |
22 | 23 |
24 constexpr size_t StreamId::kMaxSize; | |
25 | |
26 void StreamId::Set(const void* data, size_t size) { | |
27 RTC_DCHECK_LE(size, kMaxSize); | |
nisse-webrtc
2017/04/10 12:25:00
I'd like an RTC_DCHECK(memchr(data, 0, size) == nu
danilchap
2017/04/10 13:27:05
Prefer to find those value acceptible. Added comme
nisse-webrtc
2017/04/11 07:59:24
Is that that the ArrayView constructor? I think th
danilchap
2017/04/11 10:05:26
std::string_view would make more sense for StreamI
| |
28 memcpy(value_, data, size); | |
29 if (size < kMaxSize) | |
30 value_[size] = 0; | |
31 } | |
32 | |
33 static_assert(std::is_trivially_destructible<StreamId>::value, ""); | |
34 | |
23 RTPHeaderExtension::RTPHeaderExtension() | 35 RTPHeaderExtension::RTPHeaderExtension() |
24 : hasTransmissionTimeOffset(false), | 36 : hasTransmissionTimeOffset(false), |
25 transmissionTimeOffset(0), | 37 transmissionTimeOffset(0), |
26 hasAbsoluteSendTime(false), | 38 hasAbsoluteSendTime(false), |
27 absoluteSendTime(0), | 39 absoluteSendTime(0), |
28 hasTransportSequenceNumber(false), | 40 hasTransportSequenceNumber(false), |
29 transportSequenceNumber(0), | 41 transportSequenceNumber(0), |
30 hasAudioLevel(false), | 42 hasAudioLevel(false), |
31 voiceActivity(false), | 43 voiceActivity(false), |
32 audioLevel(0), | 44 audioLevel(0), |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 // Get the sum of all the temporal layer for a specific spatial layer. | 190 // Get the sum of all the temporal layer for a specific spatial layer. |
179 uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const { | 191 uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const { |
180 RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); | 192 RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
181 uint32_t sum = 0; | 193 uint32_t sum = 0; |
182 for (int i = 0; i < kMaxTemporalStreams; ++i) | 194 for (int i = 0; i < kMaxTemporalStreams; ++i) |
183 sum += bitrates_[spatial_index][i]; | 195 sum += bitrates_[spatial_index][i]; |
184 return sum; | 196 return sum; |
185 } | 197 } |
186 | 198 |
187 } // namespace webrtc | 199 } // namespace webrtc |
OLD | NEW |