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

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

Issue 2259213002: Reformat rtcp_receiver (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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 21 matching lines...) Expand all
32 sliPictureId(0), 32 sliPictureId(0),
33 rpsiPictureId(0), 33 rpsiPictureId(0),
34 receiverEstimatedMaxBitrate(0), 34 receiverEstimatedMaxBitrate(0),
35 ntp_secs(0), 35 ntp_secs(0),
36 ntp_frac(0), 36 ntp_frac(0),
37 rtp_timestamp(0), 37 rtp_timestamp(0),
38 xr_originator_ssrc(0), 38 xr_originator_ssrc(0),
39 xr_dlrr_item(false), 39 xr_dlrr_item(false),
40 VoIPMetric(nullptr) {} 40 VoIPMetric(nullptr) {}
41 41
42 RTCPPacketInformation::~RTCPPacketInformation() 42 RTCPPacketInformation::~RTCPPacketInformation() {
43 { 43 delete[] applicationData;
44 delete [] applicationData;
45 } 44 }
46 45
47 void 46 void RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric) {
48 RTCPPacketInformation::AddVoIPMetric(const RTCPVoIPMetric* metric) 47 VoIPMetric.reset(new RTCPVoIPMetric());
49 { 48 memcpy(VoIPMetric.get(), metric, sizeof(RTCPVoIPMetric));
50 VoIPMetric.reset(new RTCPVoIPMetric());
51 memcpy(VoIPMetric.get(), metric, sizeof(RTCPVoIPMetric));
52 } 49 }
53 50
54 void RTCPPacketInformation::AddApplicationData(const uint8_t* data, 51 void RTCPPacketInformation::AddApplicationData(const uint8_t* data,
55 const uint16_t size) { 52 const uint16_t size) {
56 uint8_t* oldData = applicationData; 53 uint8_t* oldData = applicationData;
57 uint16_t oldLength = applicationLength; 54 uint16_t oldLength = applicationLength;
58 55
59 // Don't copy more than kRtcpAppCode_DATA_SIZE bytes. 56 // Don't copy more than kRtcpAppCode_DATA_SIZE bytes.
60 uint16_t copySize = size; 57 uint16_t copySize = size;
61 if (size > kRtcpAppCode_DATA_SIZE) { 58 if (size > kRtcpAppCode_DATA_SIZE) {
62 copySize = kRtcpAppCode_DATA_SIZE; 59 copySize = kRtcpAppCode_DATA_SIZE;
63 } 60 }
64 61
65 applicationLength += copySize; 62 applicationLength += copySize;
66 applicationData = new uint8_t[applicationLength]; 63 applicationData = new uint8_t[applicationLength];
67 64
68 if (oldData) 65 if (oldData) {
69 { 66 memcpy(applicationData, oldData, oldLength);
70 memcpy(applicationData, oldData, oldLength); 67 memcpy(applicationData + oldLength, data, copySize);
71 memcpy(applicationData+oldLength, data, copySize); 68 delete[] oldData;
72 delete [] oldData; 69 } else {
73 } else 70 memcpy(applicationData, data, copySize);
74 { 71 }
75 memcpy(applicationData, data, copySize);
76 }
77 } 72 }
78 73
79 void 74 void RTCPPacketInformation::ResetNACKPacketIdArray() {
80 RTCPPacketInformation::ResetNACKPacketIdArray()
81 {
82 nackSequenceNumbers.clear(); 75 nackSequenceNumbers.clear();
83 } 76 }
84 77
85 void 78 void RTCPPacketInformation::AddNACKPacket(const uint16_t packetID) {
86 RTCPPacketInformation::AddNACKPacket(const uint16_t packetID)
87 {
88 if (nackSequenceNumbers.size() >= kSendSideNackListSizeSanity) { 79 if (nackSequenceNumbers.size() >= kSendSideNackListSizeSanity) {
89 return; 80 return;
90 } 81 }
91 nackSequenceNumbers.push_back(packetID); 82 nackSequenceNumbers.push_back(packetID);
92 } 83 }
93 84
94 void 85 void RTCPPacketInformation::AddReportInfo(
95 RTCPPacketInformation::AddReportInfo( 86 const RTCPReportBlockInformation& report_block_info) {
96 const RTCPReportBlockInformation& report_block_info)
97 {
98 this->rtt = report_block_info.RTT; 87 this->rtt = report_block_info.RTT;
99 report_blocks.push_back(report_block_info.remoteReceiveBlock); 88 report_blocks.push_back(report_block_info.remoteReceiveBlock);
100 } 89 }
101 90
102 RTCPReportBlockInformation::RTCPReportBlockInformation(): 91 RTCPReportBlockInformation::RTCPReportBlockInformation()
103 remoteReceiveBlock(), 92 : remoteReceiveBlock(),
104 remoteMaxJitter(0), 93 remoteMaxJitter(0),
105 RTT(0), 94 RTT(0),
106 minRTT(0), 95 minRTT(0),
107 maxRTT(0), 96 maxRTT(0),
108 avgRTT(0), 97 avgRTT(0),
109 numAverageCalcs(0) 98 numAverageCalcs(0) {
110 { 99 memset(&remoteReceiveBlock, 0, sizeof(remoteReceiveBlock));
111 memset(&remoteReceiveBlock,0,sizeof(remoteReceiveBlock));
112 } 100 }
113 101
114 RTCPReportBlockInformation::~RTCPReportBlockInformation() 102 RTCPReportBlockInformation::~RTCPReportBlockInformation() {}
115 {
116 }
117 103
118 RTCPReceiveInformation::RTCPReceiveInformation() = default; 104 RTCPReceiveInformation::RTCPReceiveInformation() = default;
119 RTCPReceiveInformation::~RTCPReceiveInformation() = default; 105 RTCPReceiveInformation::~RTCPReceiveInformation() = default;
120 106
121 void RTCPReceiveInformation::InsertTmmbrItem(uint32_t sender_ssrc, 107 void RTCPReceiveInformation::InsertTmmbrItem(uint32_t sender_ssrc,
122 const rtcp::TmmbItem& tmmbr_item, 108 const rtcp::TmmbItem& tmmbr_item,
123 int64_t current_time_ms) { 109 int64_t current_time_ms) {
124 TimedTmmbrItem* entry = &tmmbr_[sender_ssrc]; 110 TimedTmmbrItem* entry = &tmmbr_[sender_ssrc];
125 entry->tmmbr_item = rtcp::TmmbItem(sender_ssrc, 111 entry->tmmbr_item = rtcp::TmmbItem(sender_ssrc, tmmbr_item.bitrate_bps(),
126 tmmbr_item.bitrate_bps(),
127 tmmbr_item.packet_overhead()); 112 tmmbr_item.packet_overhead());
128 entry->last_updated_ms = current_time_ms; 113 entry->last_updated_ms = current_time_ms;
129 } 114 }
130 115
131 void RTCPReceiveInformation::GetTmmbrSet( 116 void RTCPReceiveInformation::GetTmmbrSet(
132 int64_t current_time_ms, 117 int64_t current_time_ms,
133 std::vector<rtcp::TmmbItem>* candidates) { 118 std::vector<rtcp::TmmbItem>* candidates) {
134 // Use audio define since we don't know what interval the remote peer use. 119 // Use audio define since we don't know what interval the remote peer use.
135 int64_t timeouted_ms = current_time_ms - 5 * RTCP_INTERVAL_AUDIO_MS; 120 int64_t timeouted_ms = current_time_ms - 5 * RTCP_INTERVAL_AUDIO_MS;
136 for (auto it = tmmbr_.begin(); it != tmmbr_.end();) { 121 for (auto it = tmmbr_.begin(); it != tmmbr_.end();) {
137 if (it->second.last_updated_ms < timeouted_ms) { 122 if (it->second.last_updated_ms < timeouted_ms) {
138 // Erase timeout entries. 123 // Erase timeout entries.
139 it = tmmbr_.erase(it); 124 it = tmmbr_.erase(it);
140 } else { 125 } else {
141 candidates->push_back(it->second.tmmbr_item); 126 candidates->push_back(it->second.tmmbr_item);
142 ++it; 127 ++it;
143 } 128 }
144 } 129 }
145 } 130 }
146 131
147 void RTCPReceiveInformation::ClearTmmbr() { 132 void RTCPReceiveInformation::ClearTmmbr() {
148 tmmbr_.clear(); 133 tmmbr_.clear();
149 } 134 }
150 135
151 } // namespace RTCPHelp 136 } // namespace RTCPHelp
152 } // namespace webrtc 137 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_receiver_help.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698