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 char* data, size_t size) { | |
27 // If |data| contains \0, the stream id size might become less than |size|. | |
28 RTC_DCHECK_LE(size, kMaxSize); | |
29 memcpy(value_, data, size); | |
30 if (size < kMaxSize) | |
31 value_[size] = 0; | |
32 } | |
33 | |
34 static_assert(std::is_trivially_destructible<StreamId>::value, ""); | |
stefan-webrtc
2017/04/19 06:46:16
Maybe add a message explaining why this must be tr
danilchap
2017/04/19 08:16:54
Done.
| |
35 | |
23 RTPHeaderExtension::RTPHeaderExtension() | 36 RTPHeaderExtension::RTPHeaderExtension() |
24 : hasTransmissionTimeOffset(false), | 37 : hasTransmissionTimeOffset(false), |
25 transmissionTimeOffset(0), | 38 transmissionTimeOffset(0), |
26 hasAbsoluteSendTime(false), | 39 hasAbsoluteSendTime(false), |
27 absoluteSendTime(0), | 40 absoluteSendTime(0), |
28 hasTransportSequenceNumber(false), | 41 hasTransportSequenceNumber(false), |
29 transportSequenceNumber(0), | 42 transportSequenceNumber(0), |
30 hasAudioLevel(false), | 43 hasAudioLevel(false), |
31 voiceActivity(false), | 44 voiceActivity(false), |
32 audioLevel(0), | 45 audioLevel(0), |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
180 // Get the sum of all the temporal layer for a specific spatial layer. | 193 // Get the sum of all the temporal layer for a specific spatial layer. |
181 uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const { | 194 uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const { |
182 RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); | 195 RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); |
183 uint32_t sum = 0; | 196 uint32_t sum = 0; |
184 for (int i = 0; i < kMaxTemporalStreams; ++i) | 197 for (int i = 0; i < kMaxTemporalStreams; ++i) |
185 sum += bitrates_[spatial_index][i]; | 198 sum += bitrates_[spatial_index][i]; |
186 return sum; | 199 return sum; |
187 } | 200 } |
188 | 201 |
189 } // namespace webrtc | 202 } // namespace webrtc |
OLD | NEW |