summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2011-04-19 19:04:32 -0700
committerDima Zavin <dima@android.com>2011-04-27 16:20:22 -0700
commit5a61d2f277af3098fc10b2881babca16391362da (patch)
treeb242a8b77bdf78a631cdc014051c7b5d79457215 /services
parent799a70e7028a4d714436c3a744a775acfbd31aae (diff)
downloadframeworks_av-5a61d2f277af3098fc10b2881babca16391362da.zip
frameworks_av-5a61d2f277af3098fc10b2881babca16391362da.tar.gz
frameworks_av-5a61d2f277af3098fc10b2881babca16391362da.tar.bz2
audioflinger: don't do work in constructor, instead do it in onFirstRef
Change-Id: I22d9e01821816c3beb52b014330386c7fd2f0411 Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp15
-rw-r--r--services/audioflinger/AudioFlinger.h2
2 files changed, 15 insertions, 2 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index e494d05..f8ad5bb 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -172,6 +172,10 @@ AudioFlinger::AudioFlinger()
: BnAudioFlinger(),
mPrimaryHardwareDev(0), mMasterVolume(1.0f), mMasterMute(false), mNextUniqueId(1)
{
+}
+
+void AudioFlinger::onFirstRef()
+{
int rc = 0;
Mutex::Autolock _l(mLock);
@@ -194,8 +198,7 @@ AudioFlinger::AudioFlinger()
if (!mPrimaryHardwareDev) {
mPrimaryHardwareDev = dev;
LOGI("Using '%s' (%s.%s) as the primary audio interface",
- AUDIO_HARDWARE_INTERFACE, mod->name, mod->id,
- audio_interfaces[i]);
+ mod->name, mod->id, audio_interfaces[i]);
}
}
@@ -224,6 +227,14 @@ AudioFlinger::AudioFlinger()
}
}
+status_t AudioFlinger::initCheck() const
+{
+ Mutex::Autolock _l(mLock);
+ if (mPrimaryHardwareDev == NULL || mAudioHwDevs.size() == 0)
+ return NO_INIT;
+ return NO_ERROR;
+}
+
AudioFlinger::~AudioFlinger()
{
int num_devs = mAudioHwDevs.size();
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 94f7861..22e5116 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -212,6 +212,8 @@ private:
AudioFlinger();
virtual ~AudioFlinger();
+ status_t initCheck() const;
+ virtual void onFirstRef();
audio_hw_device_t* findSuitableHwDev_l(uint32_t devices);
// Internal dump utilites.