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

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

Issue 2867713003: Remove hardcoded kValueSizeBytes values from variable-length header extensions. (Closed)
Patch Set: Created 3 years, 7 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 27 matching lines...) Expand all
38 constexpr size_t kMaxPaddingLength = 224; 38 constexpr size_t kMaxPaddingLength = 224;
39 constexpr size_t kMinAudioPaddingLength = 50; 39 constexpr size_t kMinAudioPaddingLength = 50;
40 constexpr int kSendSideDelayWindowMs = 1000; 40 constexpr int kSendSideDelayWindowMs = 1000;
41 constexpr size_t kRtpHeaderLength = 12; 41 constexpr size_t kRtpHeaderLength = 12;
42 constexpr uint16_t kMaxInitRtpSeqNumber = 32767; // 2^15 -1. 42 constexpr uint16_t kMaxInitRtpSeqNumber = 32767; // 2^15 -1.
43 constexpr uint32_t kTimestampTicksPerMs = 90; 43 constexpr uint32_t kTimestampTicksPerMs = 90;
44 constexpr int kBitrateStatisticsWindowMs = 1000; 44 constexpr int kBitrateStatisticsWindowMs = 1000;
45 45
46 constexpr size_t kMinFlexfecPacketsToStoreForPacing = 50; 46 constexpr size_t kMinFlexfecPacketsToStoreForPacing = 50;
47 47
48 constexpr RTPExtensionSizeInfo kExtensionSizes[] = {
danilchap 2017/05/08 16:25:06 can you add a comment or change variable name to e
erikvarga1 2017/05/09 11:40:03 Done. I've renamed this to show that it can be use
49 CreateExtensionSizeInfo<AbsoluteSendTime>(),
50 CreateExtensionSizeInfo<TransmissionOffset>(),
51 CreateExtensionSizeInfo<TransportSequenceNumber>(),
52 CreateExtensionSizeInfo<PlayoutDelayLimits>(),
53 };
54
48 const char* FrameTypeToString(FrameType frame_type) { 55 const char* FrameTypeToString(FrameType frame_type) {
49 switch (frame_type) { 56 switch (frame_type) {
50 case kEmptyFrame: 57 case kEmptyFrame:
51 return "empty"; 58 return "empty";
52 case kAudioFrameSpeech: return "audio_speech"; 59 case kAudioFrameSpeech: return "audio_speech";
53 case kAudioFrameCN: return "audio_cn"; 60 case kAudioFrameCN: return "audio_cn";
54 case kVideoFrameKey: return "video_key"; 61 case kVideoFrameKey: return "video_key";
55 case kVideoFrameDelta: return "video_delta"; 62 case kVideoFrameDelta: return "video_delta";
56 } 63 }
57 return ""; 64 return "";
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 961
955 rtc::CritScope lock(&statistics_crit_); 962 rtc::CritScope lock(&statistics_crit_);
956 bitrate_callback_->Notify(total_bitrate_sent_.Rate(now_ms).value_or(0), 963 bitrate_callback_->Notify(total_bitrate_sent_.Rate(now_ms).value_or(0),
957 nack_bitrate_sent_.Rate(now_ms).value_or(0), ssrc); 964 nack_bitrate_sent_.Rate(now_ms).value_or(0), ssrc);
958 } 965 }
959 966
960 size_t RTPSender::RtpHeaderLength() const { 967 size_t RTPSender::RtpHeaderLength() const {
961 rtc::CritScope lock(&send_critsect_); 968 rtc::CritScope lock(&send_critsect_);
962 size_t rtp_header_length = kRtpHeaderLength; 969 size_t rtp_header_length = kRtpHeaderLength;
963 rtp_header_length += sizeof(uint32_t) * csrcs_.size(); 970 rtp_header_length += sizeof(uint32_t) * csrcs_.size();
964 rtp_header_length += rtp_header_extension_map_.GetTotalLengthInBytes(); 971 rtp_header_length +=
972 rtp_header_extension_map_.GetTotalLengthInBytes(kExtensionSizes);
965 return rtp_header_length; 973 return rtp_header_length;
966 } 974 }
967 975
968 uint16_t RTPSender::AllocateSequenceNumber(uint16_t packets_to_send) { 976 uint16_t RTPSender::AllocateSequenceNumber(uint16_t packets_to_send) {
969 rtc::CritScope lock(&send_critsect_); 977 rtc::CritScope lock(&send_critsect_);
970 uint16_t first_allocated_sequence_number = sequence_number_; 978 uint16_t first_allocated_sequence_number = sequence_number_;
971 sequence_number_ += packets_to_send; 979 sequence_number_ += packets_to_send;
972 return first_allocated_sequence_number; 980 return first_allocated_sequence_number;
973 } 981 }
974 982
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { 1265 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) {
1258 return; 1266 return;
1259 } 1267 }
1260 rtp_overhead_bytes_per_packet_ = packet.headers_size(); 1268 rtp_overhead_bytes_per_packet_ = packet.headers_size();
1261 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; 1269 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_;
1262 } 1270 }
1263 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); 1271 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet);
1264 } 1272 }
1265 1273
1266 } // namespace webrtc 1274 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698