diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-29 19:57:50 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-29 19:57:50 +0000 |
commit | 1a9556a32d05d62d0efb8ef045bb91a421c29a6a (patch) | |
tree | d21bd43909a2bce6313d18805c16f0383ddb26de | |
parent | 6085cdcc74dfb36f079002c2643445452fb7b627 (diff) | |
download | chromium_src-1a9556a32d05d62d0efb8ef045bb91a421c29a6a.zip chromium_src-1a9556a32d05d62d0efb8ef045bb91a421c29a6a.tar.gz chromium_src-1a9556a32d05d62d0efb8ef045bb91a421c29a6a.tar.bz2 |
Revert 53992 - 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
TBR=davej@chromium.org
Review URL: http://codereview.chromium.org/3013042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54170 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, 10 insertions, 9 deletions
diff --git a/chrome/browser/chromeos/audio_handler.cc b/chrome/browser/chromeos/audio_handler.cc index ed2841a..e027d42 100644 --- a/chrome/browser/chromeos/audio_handler.cc +++ b/chrome/browser/chromeos/audio_handler.cc @@ -95,15 +95,18 @@ void AudioHandler::SetMute(bool do_mute) { mixer_->SetMute(do_mute); } -bool AudioHandler::IsValid() { - return mixer_->CheckState() == PulseAudioMixer::READY; +void AudioHandler::OnMixerInitialized(bool success) { + connected_ = success; + DLOG(INFO) << "OnMixerInitialized, success = " << success; } AudioHandler::AudioHandler() - : reconnect_tries_(0) { + : connected_(false), + reconnect_tries_(0) { mixer_.reset(new PulseAudioMixer()); - connected_ = mixer_->InitSync(); - DLOG(INFO) << "Mixer connected = " << connected_; + if (!mixer_->Init(NewCallback(this, &AudioHandler::OnMixerInitialized))) { + LOG(ERROR) << "Unable to connect to PulseAudio"; + } } AudioHandler::~AudioHandler() { diff --git a/chrome/browser/chromeos/audio_handler.h b/chrome/browser/chromeos/audio_handler.h index ccf0ee1..67addcb 100644 --- a/chrome/browser/chromeos/audio_handler.h +++ b/chrome/browser/chromeos/audio_handler.h @@ -42,15 +42,13 @@ 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(); |