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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.cc

Issue 2348623003: Unify rtcp packet setters (Closed)
Patch Set: +call/rtc_event_log_unittest Created 4 years, 2 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) 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 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 0x80 | static_cast<uint8_t>(picture_id_ >> (i * kPidBits)); 123 0x80 | static_cast<uint8_t>(picture_id_ >> (i * kPidBits));
124 } 124 }
125 packet[(*index)++] = static_cast<uint8_t>(picture_id_ & 0x7f); 125 packet[(*index)++] = static_cast<uint8_t>(picture_id_ & 0x7f);
126 constexpr uint8_t kPadding = 0; 126 constexpr uint8_t kPadding = 0;
127 for (size_t i = 0; i < padding_bytes; ++i) 127 for (size_t i = 0; i < padding_bytes; ++i)
128 packet[(*index)++] = kPadding; 128 packet[(*index)++] = kPadding;
129 RTC_CHECK_EQ(*index, index_end); 129 RTC_CHECK_EQ(*index, index_end);
130 return true; 130 return true;
131 } 131 }
132 132
133 void Rpsi::WithPayloadType(uint8_t payload) { 133 void Rpsi::SetPayloadType(uint8_t payload) {
134 RTC_DCHECK_LE(payload, 0x7f); 134 RTC_DCHECK_LE(payload, 0x7f);
135 payload_type_ = payload; 135 payload_type_ = payload;
136 } 136 }
137 137
138 void Rpsi::WithPictureId(uint64_t picture_id) { 138 void Rpsi::SetPictureId(uint64_t picture_id) {
139 picture_id_ = picture_id; 139 picture_id_ = picture_id;
140 block_length_ = CalculateBlockLength(RequiredBytes(picture_id_)); 140 block_length_ = CalculateBlockLength(RequiredBytes(picture_id_));
141 } 141 }
142 142
143 size_t Rpsi::CalculateBlockLength(uint8_t bitstring_size_bytes) { 143 size_t Rpsi::CalculateBlockLength(uint8_t bitstring_size_bytes) {
144 return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength + 144 return RtcpPacket::kHeaderLength + Psfb::kCommonFeedbackLength +
145 Word32Align(2 + bitstring_size_bytes); 145 Word32Align(2 + bitstring_size_bytes);
146 } 146 }
147 } // namespace rtcp 147 } // namespace rtcp
148 } // namespace webrtc 148 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi.h ('k') | webrtc/modules/rtp_rtcp/source/rtcp_packet/rpsi_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698