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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2994633002: Renamed fields in rtp_rtcp_defines.h/RTCPReportBlock (Closed)
Patch Set: Created 3 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/video/report_block_stats_unittest.cc ('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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 int total_number_of_packets = 0; 366 int total_number_of_packets = 0;
367 367
368 // If receiving multiple report blocks, calculate the weighted average based 368 // If receiving multiple report blocks, calculate the weighted average based
369 // on the number of packets a report refers to. 369 // on the number of packets a report refers to.
370 for (ReportBlockList::const_iterator block_it = report_blocks.begin(); 370 for (ReportBlockList::const_iterator block_it = report_blocks.begin();
371 block_it != report_blocks.end(); ++block_it) { 371 block_it != report_blocks.end(); ++block_it) {
372 // Find the previous extended high sequence number for this remote SSRC, 372 // Find the previous extended high sequence number for this remote SSRC,
373 // to calculate the number of RTP packets this report refers to. Ignore if 373 // to calculate the number of RTP packets this report refers to. Ignore if
374 // we haven't seen this SSRC before. 374 // we haven't seen this SSRC before.
375 std::map<uint32_t, uint32_t>::iterator seq_num_it = 375 std::map<uint32_t, uint32_t>::iterator seq_num_it =
376 extended_max_sequence_number_.find(block_it->sourceSSRC); 376 extended_max_sequence_number_.find(block_it->source_ssrc);
377 int number_of_packets = 0; 377 int number_of_packets = 0;
378 if (seq_num_it != extended_max_sequence_number_.end()) { 378 if (seq_num_it != extended_max_sequence_number_.end()) {
379 number_of_packets = block_it->extendedHighSeqNum - seq_num_it->second; 379 number_of_packets =
380 block_it->extended_highest_sequence_number - seq_num_it->second;
380 } 381 }
381 fraction_lost_aggregate += number_of_packets * block_it->fractionLost; 382 fraction_lost_aggregate += number_of_packets * block_it->fraction_lost;
382 total_number_of_packets += number_of_packets; 383 total_number_of_packets += number_of_packets;
383 384
384 extended_max_sequence_number_[block_it->sourceSSRC] = 385 extended_max_sequence_number_[block_it->source_ssrc] =
385 block_it->extendedHighSeqNum; 386 block_it->extended_highest_sequence_number;
386 } 387 }
387 int weighted_fraction_lost = 0; 388 int weighted_fraction_lost = 0;
388 if (total_number_of_packets > 0) { 389 if (total_number_of_packets > 0) {
389 weighted_fraction_lost = 390 weighted_fraction_lost =
390 (fraction_lost_aggregate + total_number_of_packets / 2) / 391 (fraction_lost_aggregate + total_number_of_packets / 2) /
391 total_number_of_packets; 392 total_number_of_packets;
392 } 393 }
393 owner_->OnUplinkPacketLossRate(weighted_fraction_lost / 255.0f); 394 owner_->OnUplinkPacketLossRate(weighted_fraction_lost / 255.0f);
394 } 395 }
395 396
(...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2641 if (_rtpRtcpModule->RemoteRTCPStat(&rtcp_report_blocks) != 0) { 2642 if (_rtpRtcpModule->RemoteRTCPStat(&rtcp_report_blocks) != 0) {
2642 return -1; 2643 return -1;
2643 } 2644 }
2644 2645
2645 if (rtcp_report_blocks.empty()) 2646 if (rtcp_report_blocks.empty())
2646 return 0; 2647 return 0;
2647 2648
2648 std::vector<RTCPReportBlock>::const_iterator it = rtcp_report_blocks.begin(); 2649 std::vector<RTCPReportBlock>::const_iterator it = rtcp_report_blocks.begin();
2649 for (; it != rtcp_report_blocks.end(); ++it) { 2650 for (; it != rtcp_report_blocks.end(); ++it) {
2650 ReportBlock report_block; 2651 ReportBlock report_block;
2651 report_block.sender_SSRC = it->remoteSSRC; 2652 report_block.sender_SSRC = it->sender_ssrc;
2652 report_block.source_SSRC = it->sourceSSRC; 2653 report_block.source_SSRC = it->source_ssrc;
2653 report_block.fraction_lost = it->fractionLost; 2654 report_block.fraction_lost = it->fraction_lost;
2654 report_block.cumulative_num_packets_lost = it->cumulativeLost; 2655 report_block.cumulative_num_packets_lost = it->packets_lost;
2655 report_block.extended_highest_sequence_number = it->extendedHighSeqNum; 2656 report_block.extended_highest_sequence_number =
2657 it->extended_highest_sequence_number;
2656 report_block.interarrival_jitter = it->jitter; 2658 report_block.interarrival_jitter = it->jitter;
2657 report_block.last_SR_timestamp = it->lastSR; 2659 report_block.last_SR_timestamp = it->last_sender_report_timestamp;
2658 report_block.delay_since_last_SR = it->delaySinceLastSR; 2660 report_block.delay_since_last_SR = it->delay_since_last_sender_report;
2659 report_blocks->push_back(report_block); 2661 report_blocks->push_back(report_block);
2660 } 2662 }
2661 return 0; 2663 return 0;
2662 } 2664 }
2663 2665
2664 int Channel::GetRTPStatistics(CallStatistics& stats) { 2666 int Channel::GetRTPStatistics(CallStatistics& stats) {
2665 // --- RtcpStatistics 2667 // --- RtcpStatistics
2666 2668
2667 // The jitter statistics is updated for each received RTP packet and is 2669 // The jitter statistics is updated for each received RTP packet and is
2668 // based on received packets. 2670 // based on received packets.
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
3135 if (channel) { 3137 if (channel) {
3136 // To prevent infinite recursion and deadlock, calling GetRTT of 3138 // To prevent infinite recursion and deadlock, calling GetRTT of
3137 // associate channel should always use "false" for argument: 3139 // associate channel should always use "false" for argument:
3138 // |allow_associate_channel|. 3140 // |allow_associate_channel|.
3139 rtt = channel->GetRTT(false); 3141 rtt = channel->GetRTT(false);
3140 } 3142 }
3141 } 3143 }
3142 return rtt; 3144 return rtt;
3143 } 3145 }
3144 3146
3145 uint32_t remoteSSRC = rtp_receiver_->SSRC(); 3147 uint32_t remoteSSRC = rtp_receiver_->SSRC();
stefan-webrtc 2017/08/07 10:43:24 Would be nice to also change this to sender_ssrc.
srte 2017/08/07 12:17:30 While that would not be wrong, I'm not sure it'd a
3146 std::vector<RTCPReportBlock>::const_iterator it = report_blocks.begin(); 3148 std::vector<RTCPReportBlock>::const_iterator it = report_blocks.begin();
3147 for (; it != report_blocks.end(); ++it) { 3149 for (; it != report_blocks.end(); ++it) {
3148 if (it->remoteSSRC == remoteSSRC) 3150 if (it->sender_ssrc == remoteSSRC)
3149 break; 3151 break;
3150 } 3152 }
3151 if (it == report_blocks.end()) { 3153 if (it == report_blocks.end()) {
3152 // We have not received packets with SSRC matching the report blocks. 3154 // We have not received packets with SSRC matching the report blocks.
3153 // To calculate RTT we try with the SSRC of the first report block. 3155 // To calculate RTT we try with the SSRC of the first report block.
3154 // This is very important for send-only channels where we don't know 3156 // This is very important for send-only channels where we don't know
3155 // the SSRC of the other end. 3157 // the SSRC of the other end.
3156 remoteSSRC = report_blocks[0].remoteSSRC; 3158 remoteSSRC = report_blocks[0].sender_ssrc;
3157 } 3159 }
3158 3160
3159 int64_t avg_rtt = 0; 3161 int64_t avg_rtt = 0;
3160 int64_t max_rtt = 0; 3162 int64_t max_rtt = 0;
3161 int64_t min_rtt = 0; 3163 int64_t min_rtt = 0;
3162 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3164 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3163 0) { 3165 0) {
3164 return 0; 3166 return 0;
3165 } 3167 }
3166 return rtt; 3168 return rtt;
3167 } 3169 }
3168 3170
3169 } // namespace voe 3171 } // namespace voe
3170 } // namespace webrtc 3172 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/report_block_stats_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698