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

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

Issue 2738873002: [Chromecast] Implement new volume control API (Closed)
Patch Set: no need for ALSA volume control Created 3 years, 9 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: chromecast/media/cma/backend/alsa/slew_volume.cc
diff --git a/chromecast/media/cma/backend/alsa/slew_volume.cc b/chromecast/media/cma/backend/alsa/slew_volume.cc
index baaeda09038d2daf289aeeeabebe2a9e25b8aa48..edff6e740afd38e560f19db6fd02dbbe1da095e2 100644
--- a/chromecast/media/cma/backend/alsa/slew_volume.cc
+++ b/chromecast/media/cma/backend/alsa/slew_volume.cc
@@ -38,6 +38,9 @@ void SlewVolume::SetSampleRate(int sample_rate) {
// Slew rate should be volume_to_slew / slew_time / sample_rate
void SlewVolume::SetVolume(double volume_scale) {
volume_scale_ = volume_scale;
+ if (interrupted_) {
+ current_volume_ = volume_scale_;
+ }
if (volume_scale_ > current_volume_) {
max_slew_up_ = (volume_scale_ - current_volume_) * 1000.0 /
(max_slew_time_up_ms_ * sample_rate_);
@@ -47,6 +50,11 @@ void SlewVolume::SetVolume(double volume_scale) {
}
}
+void SlewVolume::Interrupted() {
+ interrupted_ = true;
+ current_volume_ = volume_scale_;
+}
+
void SlewVolume::ProcessFMAC(bool repeat_transition,
const float* src,
int frames,
@@ -63,6 +71,7 @@ void SlewVolume::ProcessFMAC(bool repeat_transition,
return;
}
+ interrupted_ = false;
if (repeat_transition) {
current_volume_ = last_starting_volume_;
} else {
@@ -112,6 +121,7 @@ bool SlewVolume::ProcessInterleaved(int32_t* data, int frames) {
return true;
}
+ interrupted_ = false;
if (current_volume_ == volume_scale_) {
if (current_volume_ == 1.0) {
return true;

Powered by Google App Engine
This is Rietveld 408576698