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

Side by Side Diff: webrtc/common_types.cc

Issue 2805023002: Add read support of RtpStreamId/RepairedRtpStreamId header extensions. (Closed)
Patch Set: RtpStreamId::Parse return false on empty rsid Created 3 years, 8 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
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, "");
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // Get the sum of all the temporal layer for a specific spatial layer. 191 // Get the sum of all the temporal layer for a specific spatial layer.
179 uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const { 192 uint32_t BitrateAllocation::GetSpatialLayerSum(size_t spatial_index) const {
180 RTC_CHECK_LT(spatial_index, kMaxSpatialLayers); 193 RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
181 uint32_t sum = 0; 194 uint32_t sum = 0;
182 for (int i = 0; i < kMaxTemporalStreams; ++i) 195 for (int i = 0; i < kMaxTemporalStreams; ++i)
183 sum += bitrates_[spatial_index][i]; 196 sum += bitrates_[spatial_index][i];
184 return sum; 197 return sum;
185 } 198 }
186 199
187 } // namespace webrtc 200 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698