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

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, 4 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 ByteWriter<uint32_t>::WriteBigEndian(ptr, csrcs[i]); 1121 ByteWriter<uint32_t>::WriteBigEndian(ptr, csrcs[i]);
1122 ptr += 4; 1122 ptr += 4;
1123 } 1123 }
1124 header[0] = (header[0] & 0xf0) | csrcs.size(); 1124 header[0] = (header[0] & 0xf0) | csrcs.size();
1125 1125
1126 // Update length of header. 1126 // Update length of header.
1127 rtp_header_length += sizeof(uint32_t) * csrcs.size(); 1127 rtp_header_length += sizeof(uint32_t) * csrcs.size();
1128 } 1128 }
1129 1129
1130 uint16_t len = 1130 uint16_t len =
1131 BuildRTPHeaderExtension(header + rtp_header_length, marker_bit); 1131 BuildRtpHeaderExtension(header + rtp_header_length, marker_bit);
1132 if (len > 0) { 1132 if (len > 0) {
1133 header[0] |= 0x10; // Set extension bit. 1133 header[0] |= 0x10; // Set extension bit.
1134 rtp_header_length += len; 1134 rtp_header_length += len;
1135 } 1135 }
1136 return rtp_header_length; 1136 return rtp_header_length;
1137 } 1137 }
1138 1138
1139 int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer, 1139 int32_t RTPSender::BuildRTPheader(uint8_t* data_buffer,
1140 int8_t payload_type, 1140 int8_t payload_type,
1141 bool marker_bit, 1141 bool marker_bit,
1142 uint32_t capture_timestamp, 1142 uint32_t capture_timestamp,
1143 int64_t capture_time_ms, 1143 int64_t capture_time_ms,
1144 bool timestamp_provided, 1144 bool timestamp_provided,
1145 bool inc_sequence_number) { 1145 bool inc_sequence_number) {
1146 return BuildRtpHeader(data_buffer, payload_type, marker_bit,
1147 capture_timestamp, capture_time_ms);
1148 }
1149
1150 int32_t RTPSender::BuildRtpHeader(uint8_t* data_buffer,
1151 int8_t payload_type,
1152 bool marker_bit,
1153 uint32_t capture_timestamp,
1154 int64_t capture_time_ms) {
1146 assert(payload_type >= 0); 1155 assert(payload_type >= 0);
1147 rtc::CritScope lock(&send_critsect_); 1156 rtc::CritScope lock(&send_critsect_);
1148 1157
1149 if (timestamp_provided) { 1158 timestamp_ = start_timestamp_ + capture_timestamp;
1150 timestamp_ = start_timestamp_ + capture_timestamp;
1151 } else {
1152 // Make a unique time stamp.
1153 // We can't inc by the actual time, since then we increase the risk of back
1154 // timing.
1155 timestamp_++;
1156 }
1157 last_timestamp_time_ms_ = clock_->TimeInMilliseconds(); 1159 last_timestamp_time_ms_ = clock_->TimeInMilliseconds();
1158 uint32_t sequence_number = sequence_number_++; 1160 uint32_t sequence_number = sequence_number_++;
1159 capture_time_ms_ = capture_time_ms; 1161 capture_time_ms_ = capture_time_ms;
1160 last_packet_marker_bit_ = marker_bit; 1162 last_packet_marker_bit_ = marker_bit;
1161 return CreateRtpHeader(data_buffer, payload_type, ssrc_, marker_bit, 1163 return CreateRtpHeader(data_buffer, payload_type, ssrc_, marker_bit,
1162 timestamp_, sequence_number, csrcs_); 1164 timestamp_, sequence_number, csrcs_);
1163 } 1165 }
1164 1166
1165 uint16_t RTPSender::BuildRTPHeaderExtension(uint8_t* data_buffer, 1167 uint16_t RTPSender::BuildRtpHeaderExtension(uint8_t* data_buffer,
1166 bool marker_bit) const { 1168 bool marker_bit) const {
1167 if (rtp_header_extension_map_.Size() <= 0) { 1169 if (rtp_header_extension_map_.Size() <= 0) {
1168 return 0; 1170 return 0;
1169 } 1171 }
1170 // RTP header extension, RFC 3550. 1172 // RTP header extension, RFC 3550.
1171 // 0 1 2 3 1173 // 0 1 2 3
1172 // 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 1174 // 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
1173 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1175 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1174 // | defined by profile | length | 1176 // | defined by profile | length |
1175 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1177 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 } 1770 }
1769 1771
1770 void RTPSender::SetGenericFECStatus(bool enable, 1772 void RTPSender::SetGenericFECStatus(bool enable,
1771 uint8_t payload_type_red, 1773 uint8_t payload_type_red,
1772 uint8_t payload_type_fec) { 1774 uint8_t payload_type_fec) {
1773 RTC_DCHECK(!audio_configured_); 1775 RTC_DCHECK(!audio_configured_);
1774 video_->SetGenericFECStatus(enable, payload_type_red, payload_type_fec); 1776 video_->SetGenericFECStatus(enable, payload_type_red, payload_type_fec);
1775 } 1777 }
1776 1778
1777 void RTPSender::GenericFECStatus(bool* enable, 1779 void RTPSender::GenericFECStatus(bool* enable,
1778 uint8_t* payload_type_red, 1780 uint8_t* payload_type_red,
1779 uint8_t* payload_type_fec) const { 1781 uint8_t* payload_type_fec) const {
1780 RTC_DCHECK(!audio_configured_); 1782 RTC_DCHECK(!audio_configured_);
1781 video_->GenericFECStatus(enable, payload_type_red, payload_type_fec); 1783 video_->GenericFECStatus(enable, payload_type_red, payload_type_fec);
1782 } 1784 }
1783 1785
1784 int32_t RTPSender::SetFecParameters( 1786 int32_t RTPSender::SetFecParameters(
1785 const FecProtectionParams *delta_params, 1787 const FecProtectionParams *delta_params,
1786 const FecProtectionParams *key_params) { 1788 const FecProtectionParams *key_params) {
1787 if (audio_configured_) { 1789 if (audio_configured_) {
1788 return -1; 1790 return -1;
1789 } 1791 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 rtc::CritScope lock(&send_critsect_); 1887 rtc::CritScope lock(&send_critsect_);
1886 1888
1887 RtpState state; 1889 RtpState state;
1888 state.sequence_number = sequence_number_rtx_; 1890 state.sequence_number = sequence_number_rtx_;
1889 state.start_timestamp = start_timestamp_; 1891 state.start_timestamp = start_timestamp_;
1890 1892
1891 return state; 1893 return state;
1892 } 1894 }
1893 1895
1894 } // namespace webrtc 1896 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698