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

Unified Diff: webrtc/modules/audio_coding/neteq/decision_logic_normal.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
« no previous file with comments | « webrtc/modules/audio_coding/neteq/background_noise.cc ('k') | webrtc/modules/audio_coding/neteq/expand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/decision_logic_normal.cc
diff --git a/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc b/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc
index 89fdb51b0b61624c9d69be7d947ea336ba3b9369..e985ee0aa394c274ffda9ffc5bcf21429ac676de 100644
--- a/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc
+++ b/webrtc/modules/audio_coding/neteq/decision_logic_normal.cc
@@ -67,7 +67,8 @@ Operations DecisionLogicNormal::GetDecisionSpecialized(
return kNormal;
}
- const uint32_t five_seconds_samples = 5 * 8000 * fs_mult_;
+ const uint32_t five_seconds_samples =
+ static_cast<uint32_t>(5 * 8000 * fs_mult_);
// Check if the required packet is available.
if (target_timestamp == available_timestamp) {
return ExpectedPacketAvailable(prev_mode, play_dtmf);
@@ -87,10 +88,11 @@ Operations DecisionLogicNormal::CngOperation(Modes prev_mode,
uint32_t target_timestamp,
uint32_t available_timestamp) {
// Signed difference between target and available timestamp.
- int32_t timestamp_diff = (generated_noise_samples_ + target_timestamp) -
- available_timestamp;
- int32_t optimal_level_samp =
- (delay_manager_->TargetLevel() * packet_length_samples_) >> 8;
+ int32_t timestamp_diff = static_cast<int32_t>(
+ static_cast<uint32_t>(generated_noise_samples_ + target_timestamp) -
+ available_timestamp);
+ int32_t optimal_level_samp = static_cast<int32_t>(
+ (delay_manager_->TargetLevel() * packet_length_samples_) >> 8);
int32_t excess_waiting_time_samp = -timestamp_diff - optimal_level_samp;
if (excess_waiting_time_samp > optimal_level_samp / 2) {
@@ -182,11 +184,11 @@ Operations DecisionLogicNormal::FuturePacketAvailable(
// safety precaution), but make sure that the number of samples in buffer
// is no higher than 4 times the optimal level. (Note that TargetLevel()
// is in Q8.)
- int32_t timestamp_diff = (generated_noise_samples_ + target_timestamp) -
- available_timestamp;
- if (timestamp_diff >= 0 ||
+ if (static_cast<uint32_t>(generated_noise_samples_ + target_timestamp) >=
+ available_timestamp ||
cur_size_samples >
- 4 * ((delay_manager_->TargetLevel() * packet_length_samples_) >> 8)) {
+ ((delay_manager_->TargetLevel() * packet_length_samples_) >> 8) *
+ 4) {
// Time to play this new packet.
return kNormal;
} else {
« no previous file with comments | « webrtc/modules/audio_coding/neteq/background_noise.cc ('k') | webrtc/modules/audio_coding/neteq/expand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698