summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2013-08-13 09:14:51 -0700
committerGlenn Kasten <gkasten@google.com>2013-08-13 09:55:59 -0700
commit6e2ebe97f2ad0a21907f20f9ee644c4eacbb7a40 (patch)
treeea9d525f25620253ea86f434452bc37fbad73f76 /services
parente198c360d5e75a9b2097844c495c10902e7e8500 (diff)
downloadframeworks_av-6e2ebe97f2ad0a21907f20f9ee644c4eacbb7a40.zip
frameworks_av-6e2ebe97f2ad0a21907f20f9ee644c4eacbb7a40.tar.gz
frameworks_av-6e2ebe97f2ad0a21907f20f9ee644c4eacbb7a40.tar.bz2
Use curly braces in 'if' to make it easier to add logs
Change-Id: I58b33fefdd8bf703647414157a99a3223be3531c
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp15
-rw-r--r--services/audioflinger/AudioMixer.cpp9
-rw-r--r--services/audioflinger/AudioPolicyService.cpp36
-rw-r--r--services/audioflinger/AudioResampler.cpp6
-rw-r--r--services/audioflinger/AudioResamplerCubic.cpp12
-rw-r--r--services/audioflinger/Effects.cpp3
-rw-r--r--services/audioflinger/FastMixer.cpp3
-rw-r--r--services/audioflinger/Threads.cpp6
-rw-r--r--services/audioflinger/Tracks.cpp6
9 files changed, 62 insertions, 34 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index bc27bac..2fc83cc 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -157,12 +157,15 @@ AudioFlinger::AudioFlinger()
(void) property_get("af.tee", value, "0");
teeEnabled = atoi(value);
}
- if (teeEnabled & 1)
+ if (teeEnabled & 1) {
mTeeSinkInputEnabled = true;
- if (teeEnabled & 2)
+ }
+ if (teeEnabled & 2) {
mTeeSinkOutputEnabled = true;
- if (teeEnabled & 4)
+ }
+ if (teeEnabled & 4) {
mTeeSinkTrackEnabled = true;
+ }
#endif
}
@@ -1449,8 +1452,9 @@ audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module,
Mutex::Autolock _l(mLock);
outHwDev = findSuitableHwDev_l(module, *pDevices);
- if (outHwDev == NULL)
+ if (outHwDev == NULL) {
return 0;
+ }
audio_hw_device_t *hwDevHal = outHwDev->hwDevice();
audio_io_handle_t id = nextUniqueId();
@@ -1664,8 +1668,9 @@ audio_io_handle_t AudioFlinger::openInput(audio_module_handle_t module,
Mutex::Autolock _l(mLock);
inHwDev = findSuitableHwDev_l(module, *pDevices);
- if (inHwDev == NULL)
+ if (inHwDev == NULL) {
return 0;
+ }
audio_hw_device_t *inHwHal = inHwDev->hwDevice();
audio_io_handle_t id = nextUniqueId();
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index df4e029..84c7968 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -752,8 +752,7 @@ void AudioMixer::process__validate(state_t* state, int64_t pts)
const int i = 31 - __builtin_clz(en);
en &= ~(1<<i);
track_t& t = state->tracks[i];
- if (!t.doesResample() && t.volumeRL == 0)
- {
+ if (!t.doesResample() && t.volumeRL == 0) {
t.needs |= NEEDS_MUTE_ENABLED;
t.hook = track__nop;
} else {
@@ -1124,8 +1123,9 @@ void AudioMixer::process__genericNoResampling(state_t* state, int64_t pts)
t.in = t.buffer.raw;
// t.in == NULL can happen if the track was flushed just after having
// been enabled for mixing.
- if (t.in == NULL)
+ if (t.in == NULL) {
enabledTracks &= ~(1<<i);
+ }
}
e0 = enabledTracks;
@@ -1445,8 +1445,9 @@ void AudioMixer::process__TwoTracks16BitsStereoNoResampling(state_t* state,
int64_t AudioMixer::calculateOutputPTS(const track_t& t, int64_t basePTS,
int outputFrameIndex)
{
- if (AudioBufferProvider::kInvalidPTS == basePTS)
+ if (AudioBufferProvider::kInvalidPTS == basePTS) {
return AudioBufferProvider::kInvalidPTS;
+ }
return basePTS + ((outputFrameIndex * sLocalTimeFreq) / t.sampleRate);
}
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index 900b411..d6ea758 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -77,24 +77,28 @@ AudioPolicyService::AudioPolicyService()
mOutputCommandThread = new AudioCommandThread(String8("ApmOutput"), this);
/* instantiate the audio policy manager */
rc = hw_get_module(AUDIO_POLICY_HARDWARE_MODULE_ID, &module);
- if (rc)
+ if (rc) {
return;
+ }
rc = audio_policy_dev_open(module, &mpAudioPolicyDev);
ALOGE_IF(rc, "couldn't open audio policy device (%s)", strerror(-rc));
- if (rc)
+ if (rc) {
return;
+ }
rc = mpAudioPolicyDev->create_audio_policy(mpAudioPolicyDev, &aps_ops, this,
&mpAudioPolicy);
ALOGE_IF(rc, "couldn't create audio policy (%s)", strerror(-rc));
- if (rc)
+ if (rc) {
return;
+ }
rc = mpAudioPolicy->init_check(mpAudioPolicy);
ALOGE_IF(rc, "couldn't init_check the audio policy (%s)", strerror(-rc));
- if (rc)
+ if (rc) {
return;
+ }
ALOGI("Loaded audio policy from %s (%s)", module->name, module->id);
@@ -126,10 +130,12 @@ AudioPolicyService::~AudioPolicyService()
}
mInputs.clear();
- if (mpAudioPolicy != NULL && mpAudioPolicyDev != NULL)
+ if (mpAudioPolicy != NULL && mpAudioPolicyDev != NULL) {
mpAudioPolicyDev->destroy_audio_policy(mpAudioPolicyDev, mpAudioPolicy);
- if (mpAudioPolicyDev != NULL)
+ }
+ if (mpAudioPolicyDev != NULL) {
audio_policy_dev_close(mpAudioPolicyDev);
+ }
}
status_t AudioPolicyService::setDeviceConnectionState(audio_devices_t device,
@@ -1105,11 +1111,13 @@ int AudioPolicyService::setStreamVolume(audio_stream_type_t stream,
int AudioPolicyService::startTone(audio_policy_tone_t tone,
audio_stream_type_t stream)
{
- if (tone != AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION)
+ if (tone != AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION) {
ALOGE("startTone: illegal tone requested (%d)", tone);
- if (stream != AUDIO_STREAM_VOICE_CALL)
+ }
+ if (stream != AUDIO_STREAM_VOICE_CALL) {
ALOGE("startTone: illegal stream (%d) requested for tone %d", stream,
tone);
+ }
mTonePlaybackThread->startToneCommand(ToneGenerator::TONE_SUP_CALL_WAITING,
AUDIO_STREAM_VOICE_CALL);
return 0;
@@ -1500,8 +1508,9 @@ static audio_io_handle_t aps_open_dup_output(void *service,
static int aps_close_output(void *service, audio_io_handle_t output)
{
sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
- if (af == 0)
+ if (af == 0) {
return PERMISSION_DENIED;
+ }
return af->closeOutput(output);
}
@@ -1564,8 +1573,9 @@ static audio_io_handle_t aps_open_input_on_module(void *service,
static int aps_close_input(void *service, audio_io_handle_t input)
{
sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
- if (af == 0)
+ if (af == 0) {
return PERMISSION_DENIED;
+ }
return af->closeInput(input);
}
@@ -1574,8 +1584,9 @@ static int aps_set_stream_output(void *service, audio_stream_type_t stream,
audio_io_handle_t output)
{
sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
- if (af == 0)
+ if (af == 0) {
return PERMISSION_DENIED;
+ }
return af->setStreamOutput(stream, output);
}
@@ -1585,8 +1596,9 @@ static int aps_move_effects(void *service, int session,
audio_io_handle_t dst_output)
{
sp<IAudioFlinger> af = AudioSystem::get_audio_flinger();
- if (af == 0)
+ if (af == 0) {
return PERMISSION_DENIED;
+ }
return af->moveEffects(session, src_output, dst_output);
}
diff --git a/services/audioflinger/AudioResampler.cpp b/services/audioflinger/AudioResampler.cpp
index 2c3c719..323f1a4 100644
--- a/services/audioflinger/AudioResampler.cpp
+++ b/services/audioflinger/AudioResampler.cpp
@@ -339,8 +339,9 @@ void AudioResamplerOrder1::resampleStereo16(int32_t* out, size_t outFrameCount,
out[outputIndex++] += vl * Interp(mX0L, in[0], phaseFraction);
out[outputIndex++] += vr * Interp(mX0R, in[1], phaseFraction);
Advance(&inputIndex, &phaseFraction, phaseIncrement);
- if (outputIndex == outputSampleCount)
+ if (outputIndex == outputSampleCount) {
break;
+ }
}
// process input samples
@@ -434,8 +435,9 @@ void AudioResamplerOrder1::resampleMono16(int32_t* out, size_t outFrameCount,
out[outputIndex++] += vl * sample;
out[outputIndex++] += vr * sample;
Advance(&inputIndex, &phaseFraction, phaseIncrement);
- if (outputIndex == outputSampleCount)
+ if (outputIndex == outputSampleCount) {
break;
+ }
}
// process input samples
diff --git a/services/audioflinger/AudioResamplerCubic.cpp b/services/audioflinger/AudioResamplerCubic.cpp
index 18e59e9..1f9714b 100644
--- a/services/audioflinger/AudioResamplerCubic.cpp
+++ b/services/audioflinger/AudioResamplerCubic.cpp
@@ -66,8 +66,9 @@ void AudioResamplerCubic::resampleStereo16(int32_t* out, size_t outFrameCount,
if (mBuffer.frameCount == 0) {
mBuffer.frameCount = inFrameCount;
provider->getNextBuffer(&mBuffer, mPTS);
- if (mBuffer.raw == NULL)
+ if (mBuffer.raw == NULL) {
return;
+ }
// ALOGW("New buffer: offset=%p, frames=%dn", mBuffer.raw, mBuffer.frameCount);
}
int16_t *in = mBuffer.i16;
@@ -97,8 +98,9 @@ void AudioResamplerCubic::resampleStereo16(int32_t* out, size_t outFrameCount,
mBuffer.frameCount = inFrameCount;
provider->getNextBuffer(&mBuffer,
calculateOutputPTS(outputIndex / 2));
- if (mBuffer.raw == NULL)
+ if (mBuffer.raw == NULL) {
goto save_state; // ugly, but efficient
+ }
in = mBuffer.i16;
// ALOGW("New buffer: offset=%p, frames=%d", mBuffer.raw, mBuffer.frameCount);
}
@@ -132,8 +134,9 @@ void AudioResamplerCubic::resampleMono16(int32_t* out, size_t outFrameCount,
if (mBuffer.frameCount == 0) {
mBuffer.frameCount = inFrameCount;
provider->getNextBuffer(&mBuffer, mPTS);
- if (mBuffer.raw == NULL)
+ if (mBuffer.raw == NULL) {
return;
+ }
// ALOGW("New buffer: offset=%p, frames=%d", mBuffer.raw, mBuffer.frameCount);
}
int16_t *in = mBuffer.i16;
@@ -163,8 +166,9 @@ void AudioResamplerCubic::resampleMono16(int32_t* out, size_t outFrameCount,
mBuffer.frameCount = inFrameCount;
provider->getNextBuffer(&mBuffer,
calculateOutputPTS(outputIndex / 2));
- if (mBuffer.raw == NULL)
+ if (mBuffer.raw == NULL) {
goto save_state; // ugly, but efficient
+ }
// ALOGW("New buffer: offset=%p, frames=%dn", mBuffer.raw, mBuffer.frameCount);
in = mBuffer.i16;
}
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index d5a21a7..2a18104 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -116,8 +116,9 @@ status_t AudioFlinger::EffectModule::addHandle(EffectHandle *handle)
continue;
}
// first non destroyed handle is considered in control
- if (controlHandle == NULL)
+ if (controlHandle == NULL) {
controlHandle = h;
+ }
if (h->priority() <= priority) {
break;
}
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index ad9f4f2..4b36987 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -427,8 +427,9 @@ bool FastMixer::threadLoop()
}
int64_t pts;
- if (outputSink == NULL || (OK != outputSink->getNextWriteTimestamp(&pts)))
+ if (outputSink == NULL || (OK != outputSink->getNextWriteTimestamp(&pts))) {
pts = AudioBufferProvider::kInvalidPTS;
+ }
// process() is CPU-bound
mixer->process(pts);
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 580db70..862258f 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4281,8 +4281,9 @@ bool AudioFlinger::RecordThread::threadLoop()
int8_t *src = (int8_t *)mRsmpInBuffer + mRsmpInIndex * mFrameSize;
int8_t *dst = buffer.i8 + (buffer.frameCount - framesOut) *
mActiveTrack->mFrameSize;
- if (framesIn > framesOut)
+ if (framesIn > framesOut) {
framesIn = framesOut;
+ }
mRsmpInIndex += framesIn;
framesOut -= framesIn;
if (mChannelCount == mReqChannelCount) {
@@ -4989,8 +4990,7 @@ void AudioFlinger::RecordThread::readInputParameters()
mFrameCount = mBufferSize / mFrameSize;
mRsmpInBuffer = new int16_t[mFrameCount * mChannelCount];
- if (mSampleRate != mReqSampleRate && mChannelCount <= FCC_2 && mReqChannelCount <= FCC_2)
- {
+ if (mSampleRate != mReqSampleRate && mChannelCount <= FCC_2 && mReqChannelCount <= FCC_2) {
int channelCount;
// optimization: if mono to mono, use the resampler in stereo to stereo mode to avoid
// stereo to mono post process as the resampler always outputs stereo.
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 6039078..e173d4b 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -943,15 +943,17 @@ status_t AudioFlinger::PlaybackThread::TimedTrack::allocateTimedBuffer(
mTimedMemoryDealer = new MemoryDealer(kTimedBufferHeapSize,
"AudioFlingerTimed");
- if (mTimedMemoryDealer == NULL)
+ if (mTimedMemoryDealer == NULL) {
return NO_MEMORY;
+ }
}
sp<IMemory> newBuffer = mTimedMemoryDealer->allocate(size);
if (newBuffer == NULL) {
newBuffer = mTimedMemoryDealer->allocate(size);
- if (newBuffer == NULL)
+ if (newBuffer == NULL) {
return NO_MEMORY;
+ }
}
*buffer = newBuffer;