summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/AudioMixer.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-01-25 15:28:08 -0800
committerGlenn Kasten <gkasten@google.com>2012-02-03 07:37:14 -0800
commit84afa3b51ac48f84ed62489529ce78cba7fca00e (patch)
treeee9ba57cdc17668c9362b70f6bfbfcbd40a253ad /services/audioflinger/AudioMixer.cpp
parent5c0ad10b14ec2287f90f95912d98e66eef006e2a (diff)
downloadframeworks_av-84afa3b51ac48f84ed62489529ce78cba7fca00e.zip
frameworks_av-84afa3b51ac48f84ed62489529ce78cba7fca00e.tar.gz
frameworks_av-84afa3b51ac48f84ed62489529ce78cba7fca00e.tar.bz2
Constructor initialization and const fields
In constructors, initialize member fields in the initialization list rather than constructor body where possible. This allows more fields to be const, provided they are never modified. Also initialize POD fields in constructor, unless it's obvious they don't need to be initialized. In that case, put a comment instead. Remove explicit clear() in destructors on fields that are now const. Give AudioSessionRef a default constructor, so it's immutable fields can be marked const. Add comment about ~TrackBase() trick. Initialize fields in declaration order to make it easier to confirm that all fields are set. Move initialization of mHardwareStatus from onFirstRef() to constructor. Use NULL not 0 to initialize raw pointers in initialization list. Rename field mClient to mAudioFlingerClient, and getter from client() to audioFlingerClient(). Change-Id: Ib36cf6ed32f3cd19003f40a5d84046eb4c122052
Diffstat (limited to 'services/audioflinger/AudioMixer.cpp')
-rw-r--r--services/audioflinger/AudioMixer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index a01c6a8..1f7d883 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -48,9 +48,10 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate)
mState.enabledTracks= 0;
mState.needsChanged = 0;
mState.frameCount = frameCount;
+ mState.hook = process__nop;
mState.outputTemp = NULL;
mState.resampleTemp = NULL;
- mState.hook = process__nop;
+ // mState.reserved
track_t* t = mState.tracks;
for (unsigned i=0 ; i < MAX_NUM_TRACKS ; i++) {
t->needs = 0;
@@ -70,12 +71,13 @@ AudioMixer::AudioMixer(size_t frameCount, uint32_t sampleRate)
t->enabled = 0;
t->format = 16;
t->channelMask = AUDIO_CHANNEL_OUT_STEREO;
- t->buffer.raw = 0;
t->bufferProvider = NULL;
+ t->buffer.raw = NULL;
+ // t->buffer.frameCount
t->hook = NULL;
+ t->in = NULL;
t->resampler = NULL;
t->sampleRate = mSampleRate;
- t->in = NULL;
t->mainBuffer = NULL;
t->auxBuffer = NULL;
t++;