diff options
author | davej@chromium.org <davej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 19:19:54 +0000 |
---|---|---|
committer | davej@chromium.org <davej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 19:19:54 +0000 |
commit | 59e30246acc31440592eaff4ad68b32dcf67360e (patch) | |
tree | 4fef44ce2c10448e7fe8a7f6bf7772516f65dded | |
parent | ad2362c46b65dcfd8adc46092dda3e5db3781063 (diff) | |
download | chromium_src-59e30246acc31440592eaff4ad68b32dcf67360e.zip chromium_src-59e30246acc31440592eaff4ad68b32dcf67360e.tar.gz chromium_src-59e30246acc31440592eaff4ad68b32dcf67360e.tar.bz2 |
An earlier check-in (r51786, Issue 2769008) caused a memory leak on the build bots when PulseAudio was initialized on a separate worker thread. This change calls PulseAudioMixer::InitSync() so the init happens on the calling thread. For some reason, the init finishes cleanly on one thread, but not the other.
BUG=48553 (and http://code.google.com/p/chromium-os/issues/detail?id=5141)
TEST=Valgrind should not have PulseAudio related memory leaks, suppression 48553, or assertion failures.
Review URL: http://codereview.chromium.org/3026028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53992 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/audio_handler.cc | 13 | ||||
-rw-r--r-- | chrome/browser/chromeos/audio_handler.h | 6 |
2 files changed, 9 insertions, 10 deletions
diff --git a/chrome/browser/chromeos/audio_handler.cc b/chrome/browser/chromeos/audio_handler.cc index e027d42..ed2841a 100644 --- a/chrome/browser/chromeos/audio_handler.cc +++ b/chrome/browser/chromeos/audio_handler.cc @@ -95,18 +95,15 @@ void AudioHandler::SetMute(bool do_mute) { mixer_->SetMute(do_mute); } -void AudioHandler::OnMixerInitialized(bool success) { - connected_ = success; - DLOG(INFO) << "OnMixerInitialized, success = " << success; +bool AudioHandler::IsValid() { + return mixer_->CheckState() == PulseAudioMixer::READY; } AudioHandler::AudioHandler() - : connected_(false), - reconnect_tries_(0) { + : reconnect_tries_(0) { mixer_.reset(new PulseAudioMixer()); - if (!mixer_->Init(NewCallback(this, &AudioHandler::OnMixerInitialized))) { - LOG(ERROR) << "Unable to connect to PulseAudio"; - } + connected_ = mixer_->InitSync(); + DLOG(INFO) << "Mixer connected = " << connected_; } AudioHandler::~AudioHandler() { diff --git a/chrome/browser/chromeos/audio_handler.h b/chrome/browser/chromeos/audio_handler.h index 67addcb..ccf0ee1 100644 --- a/chrome/browser/chromeos/audio_handler.h +++ b/chrome/browser/chromeos/audio_handler.h @@ -42,13 +42,15 @@ class AudioHandler { // Mutes all audio. Non-blocking call. void SetMute(bool do_mute); + // AudioHandler is a singleton initialized at startup. Use this to determine + // if there is a valid connection to a mixer. + bool IsValid(); + private: // Defines the delete on exit Singleton traits we like. Best to have this // and constructor/destructor private as recommended for Singletons. friend struct DefaultSingletonTraits<AudioHandler>; - void OnMixerInitialized(bool success); - AudioHandler(); virtual ~AudioHandler(); bool VerifyMixerConnection(); |