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

Unified Diff: webrtc/modules/audio_coding/neteq/statistics_calculator.cc

Issue 1228843002: Update audio code to use size_t more correctly, (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/statistics_calculator.cc
diff --git a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
index ce800dd065d0b291b2b5cdfea08c360393f21ef9..9d1e97cf9a0213ad59382b03c1152c9581a564b3 100644
--- a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
+++ b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
@@ -54,35 +54,35 @@ void StatisticsCalculator::ResetWaitingTimeStatistics() {
next_waiting_time_index_ = 0;
}
-void StatisticsCalculator::ExpandedVoiceSamples(int num_samples) {
+void StatisticsCalculator::ExpandedVoiceSamples(size_t num_samples) {
expanded_speech_samples_ += num_samples;
}
-void StatisticsCalculator::ExpandedNoiseSamples(int num_samples) {
+void StatisticsCalculator::ExpandedNoiseSamples(size_t num_samples) {
expanded_noise_samples_ += num_samples;
}
-void StatisticsCalculator::PreemptiveExpandedSamples(int num_samples) {
+void StatisticsCalculator::PreemptiveExpandedSamples(size_t num_samples) {
preemptive_samples_ += num_samples;
}
-void StatisticsCalculator::AcceleratedSamples(int num_samples) {
+void StatisticsCalculator::AcceleratedSamples(size_t num_samples) {
accelerate_samples_ += num_samples;
}
-void StatisticsCalculator::AddZeros(int num_samples) {
+void StatisticsCalculator::AddZeros(size_t num_samples) {
added_zero_samples_ += num_samples;
}
-void StatisticsCalculator::PacketsDiscarded(int num_packets) {
+void StatisticsCalculator::PacketsDiscarded(size_t num_packets) {
discarded_packets_ += num_packets;
}
-void StatisticsCalculator::LostSamples(int num_samples) {
+void StatisticsCalculator::LostSamples(size_t num_samples) {
lost_timestamps_ += num_samples;
}
-void StatisticsCalculator::IncreaseCounter(int num_samples, int fs_hz) {
+void StatisticsCalculator::IncreaseCounter(size_t num_samples, int fs_hz) {
timestamps_since_last_report_ += static_cast<uint32_t>(num_samples);
if (timestamps_since_last_report_ >
static_cast<uint32_t>(fs_hz * kMaxReportPeriod)) {
@@ -110,8 +110,8 @@ void StatisticsCalculator::StoreWaitingTime(int waiting_time_ms) {
void StatisticsCalculator::GetNetworkStatistics(
int fs_hz,
- int num_samples_in_buffers,
- int samples_per_packet,
+ size_t num_samples_in_buffers,
+ size_t samples_per_packet,
const DelayManager& delay_manager,
const DecisionLogic& decision_logic,
NetEqNetworkStatistics *stats) {
@@ -123,8 +123,8 @@ void StatisticsCalculator::GetNetworkStatistics(
stats->added_zero_samples = added_zero_samples_;
stats->current_buffer_size_ms =
static_cast<uint16_t>(num_samples_in_buffers * 1000 / fs_hz);
- const int ms_per_packet = decision_logic.packet_length_samples() /
- (fs_hz / 1000);
+ const int ms_per_packet = static_cast<int>(
hlundin-webrtc 2015/08/10 11:30:01 rtc::checked_cast
Peter Kasting 2015/08/17 22:49:47 Done.
+ decision_logic.packet_length_samples() / (fs_hz / 1000));
stats->preferred_buffer_size_ms = (delay_manager.TargetLevel() >> 8) *
ms_per_packet;
stats->jitter_peaks_found = delay_manager.PeakFound();
@@ -133,7 +133,7 @@ void StatisticsCalculator::GetNetworkStatistics(
stats->packet_loss_rate =
CalculateQ14Ratio(lost_timestamps_, timestamps_since_last_report_);
- const unsigned discarded_samples = discarded_packets_ * samples_per_packet;
+ const size_t discarded_samples = discarded_packets_ * samples_per_packet;
stats->packet_discard_rate =
CalculateQ14Ratio(discarded_samples, timestamps_since_last_report_);
@@ -168,7 +168,7 @@ void StatisticsCalculator::WaitingTimes(std::vector<int>* waiting_times) {
ResetWaitingTimeStatistics();
}
-uint16_t StatisticsCalculator::CalculateQ14Ratio(uint32_t numerator,
+uint16_t StatisticsCalculator::CalculateQ14Ratio(size_t numerator,
uint32_t denominator) {
if (numerator == 0) {
return 0;

Powered by Google App Engine
This is Rietveld 408576698