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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender.cc

Issue 2067673004: Style cleanups in RtpSender. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 4 years, 6 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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 ByteWriter<uint32_t>::WriteBigEndian(ptr, csrcs[i]); 1233 ByteWriter<uint32_t>::WriteBigEndian(ptr, csrcs[i]);
1234 ptr += 4; 1234 ptr += 4;
1235 } 1235 }
1236 header[0] = (header[0] & 0xf0) | csrcs.size(); 1236 header[0] = (header[0] & 0xf0) | csrcs.size();
1237 1237
1238 // Update length of header. 1238 // Update length of header.
1239 rtp_header_length += sizeof(uint32_t) * csrcs.size(); 1239 rtp_header_length += sizeof(uint32_t) * csrcs.size();
1240 } 1240 }
1241 1241
1242 uint16_t len = 1242 uint16_t len =
1243 BuildRTPHeaderExtension(header + rtp_header_length, marker_bit); 1243 BuildRtpHeaderExtension(header + rtp_header_length, marker_bit);
1244 if (len > 0) { 1244 if (len > 0) {
1245 header[0] |= 0x10; // Set extension bit. 1245 header[0] |= 0x10; // Set extension bit.
1246 rtp_header_length += len; 1246 rtp_header_length += len;
1247 } 1247 }
1248 return rtp_header_length; 1248 return rtp_header_length;
1249 } 1249 }
1250 1250
1251 int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer, 1251 int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer,
1252 int8_t payload_type, 1252 int8_t payload_type,
1253 bool marker_bit, 1253 bool marker_bit,
1254 uint32_t capture_timestamp, 1254 uint32_t capture_timestamp,
1255 int64_t capture_time_ms, 1255 int64_t capture_time_ms,
1256 bool timestamp_provided, 1256 bool timestamp_provided,
1257 bool inc_sequence_number) { 1257 bool inc_sequence_number) {
1258 return BuildRtpHeader(data_buffer, payload_type, marker_bit,
1259 capture_timestamp, capture_time_ms);
1260 }
1261
1262 int32_t RTPSender::BuildRtpHeader(uint8_t* data_buffer,
1263 int8_t payload_type,
1264 bool marker_bit,
1265 uint32_t capture_timestamp,
1266 int64_t capture_time_ms) {
1258 assert(payload_type >= 0); 1267 assert(payload_type >= 0);
1259 rtc::CritScope lock(&send_critsect_); 1268 rtc::CritScope lock(&send_critsect_);
1260 1269
1261 if (timestamp_provided) { 1270 timestamp_ = start_timestamp_ + capture_timestamp;
1262 timestamp_ = start_timestamp_ + capture_timestamp;
1263 } else {
1264 // Make a unique time stamp.
1265 // We can't inc by the actual time, since then we increase the risk of back
1266 // timing.
1267 timestamp_++;
1268 }
1269 last_timestamp_time_ms_ = clock_->TimeInMilliseconds(); 1271 last_timestamp_time_ms_ = clock_->TimeInMilliseconds();
1270 uint32_t sequence_number = sequence_number_++; 1272 uint32_t sequence_number = sequence_number_++;
1271 capture_time_ms_ = capture_time_ms; 1273 capture_time_ms_ = capture_time_ms;
1272 last_packet_marker_bit_ = marker_bit; 1274 last_packet_marker_bit_ = marker_bit;
1273 return CreateRtpHeader(data_buffer, payload_type, ssrc_, marker_bit, 1275 return CreateRtpHeader(data_buffer, payload_type, ssrc_, marker_bit,
1274 timestamp_, sequence_number, csrcs_); 1276 timestamp_, sequence_number, csrcs_);
1275 } 1277 }
1276 1278
1277 uint16_t RTPSender::BuildRTPHeaderExtension(uint8_t* data_buffer, 1279 uint16_t RTPSender::BuildRtpHeaderExtension(uint8_t* data_buffer,
1278 bool marker_bit) const { 1280 bool marker_bit) const {
1279 if (rtp_header_extension_map_.Size() <= 0) { 1281 if (rtp_header_extension_map_.Size() <= 0) {
1280 return 0; 1282 return 0;
1281 } 1283 }
1282 // RTP header extension, RFC 3550. 1284 // RTP header extension, RFC 3550.
1283 // 0 1 2 3 1285 // 0 1 2 3
1284 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 1286 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
1285 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1287 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1286 // | defined by profile | length | 1288 // | defined by profile | length |
1287 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1289 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 rtc::CritScope lock(&send_critsect_); 1998 rtc::CritScope lock(&send_critsect_);
1997 1999
1998 RtpState state; 2000 RtpState state;
1999 state.sequence_number = sequence_number_rtx_; 2001 state.sequence_number = sequence_number_rtx_;
2000 state.start_timestamp = start_timestamp_; 2002 state.start_timestamp = start_timestamp_;
2001 2003
2002 return state; 2004 return state;
2003 } 2005 }
2004 2006
2005 } // namespace webrtc 2007 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698