Use audio_devices_t more places
Change-Id: Id0ace02ca6f480a6c46e11880acf6cdc66d83184
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index f033080..e66abb1 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -273,7 +273,7 @@
};
#define ARRAY_SIZE(x) (sizeof((x))/sizeof(((x)[0])))
-audio_hw_device_t* AudioFlinger::findSuitableHwDev_l(audio_module_handle_t module, uint32_t devices)
+audio_hw_device_t* AudioFlinger::findSuitableHwDev_l(audio_module_handle_t module, audio_devices_t devices)
{
// if module is 0, the request comes from an old policy manager and we should load
// well known modules
@@ -873,8 +873,7 @@
sp<RecordThread> thread = mRecordThreads.valueAt(i);
RecordThread::RecordTrack *track = thread->track();
if (track != NULL) {
- audio_devices_t device = (audio_devices_t)(
- thread->device() & AUDIO_DEVICE_IN_ALL);
+ audio_devices_t device = thread->device() & AUDIO_DEVICE_IN_ALL;
bool suspend = audio_is_bluetooth_sco_device(device) && btNrecIsOff;
thread->setEffectSuspended(FX_IID_AEC,
suspend,
@@ -1116,7 +1115,7 @@
// ----------------------------------------------------------------------------
AudioFlinger::ThreadBase::ThreadBase(const sp<AudioFlinger>& audioFlinger, audio_io_handle_t id,
- uint32_t device, type_t type)
+ audio_devices_t device, type_t type)
: Thread(false),
mType(type),
mAudioFlinger(audioFlinger), mSampleRate(0), mFrameCount(0), mNormalFrameCount(0),
@@ -1500,7 +1499,7 @@
AudioFlinger::PlaybackThread::PlaybackThread(const sp<AudioFlinger>& audioFlinger,
AudioStreamOut* output,
audio_io_handle_t id,
- uint32_t device,
+ audio_devices_t device,
type_t type)
: ThreadBase(audioFlinger, id, device, type),
mMixBuffer(NULL), mSuspended(0), mBytesWritten(0),
@@ -2181,7 +2180,7 @@
// ----------------------------------------------------------------------------
AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output,
- audio_io_handle_t id, uint32_t device, type_t type)
+ audio_io_handle_t id, audio_devices_t device, type_t type)
: PlaybackThread(audioFlinger, output, id, device, type),
// mAudioMixer below
// mFastMixer below
@@ -2190,7 +2189,7 @@
// mPipeSink below
// mNormalSink below
{
- ALOGV("MixerThread() id=%d device=%d type=%d", id, device, type);
+ ALOGV("MixerThread() id=%d device=%#x type=%d", id, device, type);
ALOGV("mSampleRate=%d, mChannelMask=%#x, mChannelCount=%d, mFormat=%d, mFrameSize=%d, "
"mFrameCount=%d, mNormalFrameCount=%d",
mSampleRate, mChannelMask, mChannelCount, mFormat, mFrameSize, mFrameCount,
@@ -3427,7 +3426,7 @@
params |= IMediaPlayerService::kBatteryDataSpeakerOn;
}
- int deviceWithoutSpeaker
+ audio_devices_t deviceWithoutSpeaker
= AUDIO_DEVICE_OUT_ALL & ~AUDIO_DEVICE_OUT_SPEAKER;
// check if any other device (except speaker) is on
if (value & deviceWithoutSpeaker ) {
@@ -3611,7 +3610,7 @@
// ----------------------------------------------------------------------------
AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger,
- AudioStreamOut* output, audio_io_handle_t id, uint32_t device)
+ AudioStreamOut* output, audio_io_handle_t id, audio_devices_t device)
: PlaybackThread(audioFlinger, output, id, device, DIRECT)
// mLeftVolFloat, mRightVolFloat
{
@@ -5900,7 +5899,7 @@
uint32_t sampleRate,
audio_channel_mask_t channelMask,
audio_io_handle_t id,
- uint32_t device) :
+ audio_devices_t device) :
ThreadBase(audioFlinger, id, device, RECORD),
mInput(input), mTrack(NULL), mResampler(NULL), mRsmpOutBuffer(NULL), mRsmpInBuffer(NULL),
// mRsmpInIndex and mInputBytes set by readInputParameters()
@@ -6179,8 +6178,8 @@
mTrack = track.get();
// disable AEC and NS if the device is a BT SCO headset supporting those pre processings
- bool suspend = audio_is_bluetooth_sco_device(
- (audio_devices_t)(mDevice & AUDIO_DEVICE_IN_ALL)) && mAudioFlinger->btNrecIsOff();
+ bool suspend = audio_is_bluetooth_sco_device(mDevice & AUDIO_DEVICE_IN_ALL) &&
+ mAudioFlinger->btNrecIsOff();
setEffectSuspended_l(FX_IID_AEC, suspend, sessionId);
setEffectSuspended_l(FX_IID_NS, suspend, sessionId);
}
@@ -6725,7 +6724,7 @@
ALOGV("openOutput(), module %d Device %x, SamplingRate %d, Format %d, Channels %x, flags %x",
module,
- (pDevices != NULL) ? (int)*pDevices : 0,
+ (pDevices != NULL) ? *pDevices : 0,
config.sample_rate,
config.format,
config.channel_mask,
@@ -6985,7 +6984,7 @@
// Start record thread
// RecorThread require both input and output device indication to forward to audio
// pre processing modules
- uint32_t device = (*pDevices) | primaryOutputDevice_l();
+ audio_devices_t device = (*pDevices) | primaryOutputDevice_l();
thread = new RecordThread(this,
input,
reqSamplingRate,
@@ -7195,7 +7194,7 @@
return NULL;
}
-uint32_t AudioFlinger::primaryOutputDevice_l() const
+audio_devices_t AudioFlinger::primaryOutputDevice_l() const
{
PlaybackThread *thread = primaryPlaybackThread_l();
@@ -8534,14 +8533,14 @@
return status;
}
-status_t AudioFlinger::EffectModule::setDevice(uint32_t device)
+status_t AudioFlinger::EffectModule::setDevice(audio_devices_t device)
{
Mutex::Autolock _l(mLock);
status_t status = NO_ERROR;
if (device && (mDescriptor.flags & EFFECT_FLAG_DEVICE_MASK) == EFFECT_FLAG_DEVICE_IND) {
// audio pre processing modules on RecordThread can receive both output and
// input device indication in the same call
- uint32_t dev = device & AUDIO_DEVICE_OUT_ALL;
+ audio_devices_t dev = device & AUDIO_DEVICE_OUT_ALL;
if (dev) {
status_t cmdStatus;
uint32_t size = sizeof(status_t);
@@ -9258,7 +9257,7 @@
}
// setDevice_l() must be called with PlaybackThread::mLock held
-void AudioFlinger::EffectChain::setDevice_l(uint32_t device)
+void AudioFlinger::EffectChain::setDevice_l(audio_devices_t device)
{
size_t size = mEffects.size();
for (size_t i = 0; i < size; i++) {