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

Unified Diff: chrome/browser/chromeos/audio_mixer_alsa.cc

Issue 6287012: Initialize values before calling ALSA APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos
Patch Set: Created 9 years, 11 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: chrome/browser/chromeos/audio_mixer_alsa.cc
diff --git a/chrome/browser/chromeos/audio_mixer_alsa.cc b/chrome/browser/chromeos/audio_mixer_alsa.cc
index a42868e339dc89ff877dfc6a3bd42ecbc60b4152..debf34e3e9f09dc9393c247ce04dd484d2dba563 100644
--- a/chrome/browser/chromeos/audio_mixer_alsa.cc
+++ b/chrome/browser/chromeos/audio_mixer_alsa.cc
@@ -252,7 +252,8 @@ bool AudioMixerAlsa::InitializeAlsaMixer() {
elem_master_ = FindElementWithName_Locked(handle, kMasterVolume);
if (elem_master_) {
- alsa_long_t long_lo, long_hi;
+ alsa_long_t long_lo = static_cast<alsa_long_t>(kDefaultMinVolume * 100);
+ alsa_long_t long_hi = static_cast<alsa_long_t>(kDefaultMaxVolume * 100);
snd_mixer_selem_get_playback_dB_range(elem_master_, &long_lo, &long_hi);
min_volume_ = static_cast<double>(long_lo) / 100.0;
max_volume_ = static_cast<double>(long_hi) / 100.0;
@@ -264,7 +265,8 @@ bool AudioMixerAlsa::InitializeAlsaMixer() {
elem_pcm_ = FindElementWithName_Locked(handle, kPCMVolume);
if (elem_pcm_) {
- alsa_long_t long_lo, long_hi;
+ alsa_long_t long_lo = static_cast<alsa_long_t>(kDefaultMinVolume * 100);
+ alsa_long_t long_hi = static_cast<alsa_long_t>(kDefaultMaxVolume * 100);
snd_mixer_selem_get_playback_dB_range(elem_pcm_, &long_lo, &long_hi);
min_volume_ += static_cast<double>(long_lo) / 100.0;
max_volume_ += static_cast<double>(long_hi) / 100.0;
@@ -413,7 +415,7 @@ bool AudioMixerAlsa::SetElementVolume_Locked(snd_mixer_elem_t* elem,
<< " dB";
if (actual_vol) {
- alsa_long_t volume;
+ alsa_long_t volume = vol_lo;
snd_mixer_selem_get_playback_volume(
elem,
static_cast<snd_mixer_selem_channel_id_t>(0),
@@ -427,7 +429,7 @@ bool AudioMixerAlsa::SetElementVolume_Locked(snd_mixer_elem_t* elem,
}
bool AudioMixerAlsa::GetElementMuted_Locked(snd_mixer_elem_t* elem) const {
- int enabled;
+ int enabled = 0;
snd_mixer_selem_get_playback_switch(
elem,
static_cast<snd_mixer_selem_channel_id_t>(0),
« 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