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

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

Issue 1168753002: Match existing type usage better. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 6 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 14e93859b8202d9ca051df4cf8a78db159ed15d2..f637eb8e9ee31aadf3cba35c336f674ec6c015ab 100644
--- a/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
+++ b/webrtc/modules/audio_coding/neteq/statistics_calculator.cc
@@ -83,7 +83,7 @@ void StatisticsCalculator::LostSamples(int num_samples) {
}
void StatisticsCalculator::IncreaseCounter(int num_samples, int fs_hz) {
- timestamps_since_last_report_ += num_samples;
+ timestamps_since_last_report_ += static_cast<uint32_t>(num_samples);
if (timestamps_since_last_report_ >
static_cast<uint32_t>(fs_hz * kMaxReportPeriod)) {
lost_timestamps_ = 0;
@@ -121,7 +121,8 @@ void StatisticsCalculator::GetNetworkStatistics(
}
stats->added_zero_samples = added_zero_samples_;
- stats->current_buffer_size_ms = num_samples_in_buffers * 1000 / fs_hz;
+ 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);
stats->preferred_buffer_size_ms = (delay_manager.TargetLevel() >> 8) *
@@ -167,14 +168,14 @@ void StatisticsCalculator::WaitingTimes(std::vector<int>* waiting_times) {
ResetWaitingTimeStatistics();
}
-int StatisticsCalculator::CalculateQ14Ratio(uint32_t numerator,
- uint32_t denominator) {
+uint16_t StatisticsCalculator::CalculateQ14Ratio(uint32_t numerator,
+ uint32_t denominator) {
if (numerator == 0) {
return 0;
} else if (numerator < denominator) {
// Ratio must be smaller than 1 in Q14.
assert((numerator << 14) / denominator < (1 << 14));
- return (numerator << 14) / denominator;
+ return static_cast<uint16_t>((numerator << 14) / denominator);
} else {
// Will not produce a ratio larger than 1, since this is probably an error.
return 1 << 14;
« no previous file with comments | « webrtc/modules/audio_coding/neteq/statistics_calculator.h ('k') | webrtc/modules/audio_coding/neteq/test/RTPencode.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698