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

Unified Diff: chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc

Issue 2100733002: Revert of [Chromecast] Use perceptually linear scaling for stream volumes (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
diff --git a/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc b/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
index 33c8937f3d3fa36d46769e094a0085956baca03d..b85d1962f2ad52e662ec82025fd9347c4a6220e6 100644
--- a/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
+++ b/chromecast/media/cma/backend/alsa/stream_mixer_alsa_input_impl.cc
@@ -479,15 +479,14 @@
}
}
-static float VolumeToScaleFactor(float volume_level) {
- volume_level = std::max(0.0f, std::min(volume_level, 1.0f));
- return powf(volume_level, 0.5f * log2(10.0f));
-}
-
-void StreamMixerAlsaInputImpl::SetVolumeMultiplier(float volume_level) {
- RUN_ON_MIXER_THREAD(SetVolumeMultiplier, volume_level);
+void StreamMixerAlsaInputImpl::SetVolumeMultiplier(float multiplier) {
+ RUN_ON_MIXER_THREAD(SetVolumeMultiplier, multiplier);
DCHECK(!IsDeleting());
- volume_multiplier_ = VolumeToScaleFactor(volume_level);
+ if (multiplier > 1.0f)
+ multiplier = 1.0f;
+ if (multiplier < 0.0f)
+ multiplier = 0.0f;
+ volume_multiplier_ = multiplier;
}
} // namespace media
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698