Commit 9d063448 authored by davej@chromium.org's avatar davej@chromium.org

Initialize values before calling ALSA APIs

There should no longer be uninitialized values reported when running CrOs build of Chrome on Linux with cross_fuzz under valgrind.

I believe the ALSA APIs should have been initializing all these values, but to be sure they are now initialized before making the calls.

BUG=chromium-os:11252
TEST=none

Review URL: http://codereview.chromium.org/6287012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72670 0039d316-1c4b-4281-b951-d872f2087c98
parent b8e2fbaf
......@@ -254,7 +254,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;
......@@ -266,7 +267,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;
......@@ -415,7 +417,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),
......@@ -429,7 +431,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),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment