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

Side by Side Diff: webrtc/modules/audio_coding/neteq/rtcp.cc

Issue 2992043002: Renamed fields in common_types.h/RtcpStatistics. (Closed)
Patch Set: Rebase on new master 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 int64_t jitter_diff = (std::abs(int64_t{ts_diff}) << 4) - jitter_; 49 int64_t jitter_diff = (std::abs(int64_t{ts_diff}) << 4) - jitter_;
50 // Calculate 15 * jitter_ / 16 + jitter_diff / 16 (with proper rounding). 50 // Calculate 15 * jitter_ / 16 + jitter_diff / 16 (with proper rounding).
51 jitter_ = jitter_ + ((jitter_diff + 8) >> 4); 51 jitter_ = jitter_ + ((jitter_diff + 8) >> 4);
52 RTC_DCHECK_GE(jitter_, 0); 52 RTC_DCHECK_GE(jitter_, 0);
53 } 53 }
54 transit_ = rtp_header.timestamp - receive_timestamp; 54 transit_ = rtp_header.timestamp - receive_timestamp;
55 } 55 }
56 56
57 void Rtcp::GetStatistics(bool no_reset, RtcpStatistics* stats) { 57 void Rtcp::GetStatistics(bool no_reset, RtcpStatistics* stats) {
58 // Extended highest sequence number received. 58 // Extended highest sequence number received.
59 stats->extended_max_sequence_number = 59 stats->extended_highest_sequence_number =
60 (static_cast<int>(cycles_) << 16) + max_seq_no_; 60 (static_cast<int>(cycles_) << 16) + max_seq_no_;
61 61
62 // Calculate expected number of packets and compare it with the number of 62 // Calculate expected number of packets and compare it with the number of
63 // packets that were actually received. The cumulative number of lost packets 63 // packets that were actually received. The cumulative number of lost packets
64 // can be extracted. 64 // can be extracted.
65 uint32_t expected_packets = 65 uint32_t expected_packets =
66 stats->extended_max_sequence_number - base_seq_no_ + 1; 66 stats->extended_highest_sequence_number - base_seq_no_ + 1;
67 if (received_packets_ == 0) { 67 if (received_packets_ == 0) {
68 // No packets received, assume none lost. 68 // No packets received, assume none lost.
69 stats->cumulative_lost = 0; 69 stats->packets_lost = 0;
70 } else if (expected_packets > received_packets_) { 70 } else if (expected_packets > received_packets_) {
71 stats->cumulative_lost = expected_packets - received_packets_; 71 stats->packets_lost = expected_packets - received_packets_;
72 if (stats->cumulative_lost > 0xFFFFFF) { 72 if (stats->packets_lost > 0xFFFFFF) {
73 stats->cumulative_lost = 0xFFFFFF; 73 stats->packets_lost = 0xFFFFFF;
74 } 74 }
75 } else { 75 } else {
76 stats->cumulative_lost = 0; 76 stats->packets_lost = 0;
77 } 77 }
78 78
79 // Fraction lost since last report. 79 // Fraction lost since last report.
80 uint32_t expected_since_last = expected_packets - expected_prior_; 80 uint32_t expected_since_last = expected_packets - expected_prior_;
81 uint32_t received_since_last = received_packets_ - received_packets_prior_; 81 uint32_t received_since_last = received_packets_ - received_packets_prior_;
82 if (!no_reset) { 82 if (!no_reset) {
83 expected_prior_ = expected_packets; 83 expected_prior_ = expected_packets;
84 received_packets_prior_ = received_packets_; 84 received_packets_prior_ = received_packets_;
85 } 85 }
86 int32_t lost = expected_since_last - received_since_last; 86 int32_t lost = expected_since_last - received_since_last;
87 if (expected_since_last == 0 || lost <= 0 || received_packets_ == 0) { 87 if (expected_since_last == 0 || lost <= 0 || received_packets_ == 0) {
88 stats->fraction_lost = 0; 88 stats->fraction_lost = 0;
89 } else { 89 } else {
90 stats->fraction_lost = std::min(0xFFU, (lost << 8) / expected_since_last); 90 stats->fraction_lost = std::min(0xFFU, (lost << 8) / expected_since_last);
91 } 91 }
92 92
93 stats->jitter = jitter_ >> 4; // Scaling from Q4. 93 stats->jitter = jitter_ >> 4; // Scaling from Q4.
94 } 94 }
95 95
96 } // namespace webrtc 96 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_unittest.cc ('k') | webrtc/modules/remote_bitrate_estimator/test/estimators/remb.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698