summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-01-19 08:59:58 -0800
committerGlenn Kasten <gkasten@google.com>2012-02-14 09:17:59 -0800
commit99e53b86eebb605b70dd7591b89bf61a9414ed0e (patch)
tree8939550ada02fe21121550a83952ebf7638c0dac /services
parent6dbc1359f778575d09d6da722b060a6d72c2e7c5 (diff)
downloadframeworks_av-99e53b86eebb605b70dd7591b89bf61a9414ed0e.zip
frameworks_av-99e53b86eebb605b70dd7591b89bf61a9414ed0e.tar.gz
frameworks_av-99e53b86eebb605b70dd7591b89bf61a9414ed0e.tar.bz2
Update comments
We no longer put the filename at start of file. Change-Id: Ic435b159a23105681e3d4a6cb1ac097bc853302e
Diffstat (limited to 'services')
-rw-r--r--services/audioflinger/AudioFlinger.cpp10
-rw-r--r--services/audioflinger/AudioFlinger.h16
-rw-r--r--services/audioflinger/AudioMixer.cpp7
-rw-r--r--services/audioflinger/AudioMixer.h2
4 files changed, 27 insertions, 8 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index fb163d1..131371e 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -1,4 +1,4 @@
-/* //device/include/server/AudioFlinger/AudioFlinger.cpp
+/*
**
** Copyright 2007, The Android Open Source Project
**
@@ -621,6 +621,7 @@ status_t AudioFlinger::setMasterMute(bool muted)
}
Mutex::Autolock _l(mLock);
+ // This is an optimization, so PlaybackThread doesn't have to look at the one from AudioFlinger
mMasterMute = muted;
for (uint32_t i = 0; i < mPlaybackThreads.size(); i++)
mPlaybackThreads.valueAt(i)->setMasterMute(muted);
@@ -3121,6 +3122,7 @@ bool AudioFlinger::DuplicatingThread::threadLoop()
void AudioFlinger::DuplicatingThread::addOutputTrack(MixerThread *thread)
{
+ // FIXME explain this formula
int frameCount = (3 * mFrameCount * mSampleRate) / thread->sampleRate();
OutputTrack *outputTrack = new OutputTrack((ThreadBase *)thread,
this,
@@ -3392,7 +3394,7 @@ void AudioFlinger::PlaybackThread::Track::destroy()
{
// NOTE: destroyTrack_l() can remove a strong reference to this Track
// by removing it from mTracks vector, so there is a risk that this Tracks's
- // desctructor is called. As the destructor needs to lock mLock,
+ // destructor is called. As the destructor needs to lock mLock,
// we must acquire a strong reference on this Track before locking mLock
// here so that the destructor is called only when exiting this function.
// On the other hand, as long as Track::destroy() is only called by
@@ -3998,6 +4000,7 @@ void AudioFlinger::PlaybackThread::OutputTrack::clearBufferQueue()
AudioFlinger::Client::Client(const sp<AudioFlinger>& audioFlinger, pid_t pid)
: RefBase(),
mAudioFlinger(audioFlinger),
+ // FIXME should be a "k" constant not hard-coded, in .h or ro. property, see 4 lines below
mMemoryDealer(new MemoryDealer(1024*1024, "AudioFlinger::Client")),
mPid(pid)
{
@@ -4659,7 +4662,7 @@ bool AudioFlinger::RecordThread::checkForNewParameters_l()
}
if (param.getInt(String8(AudioParameter::keyFrameCount), value) == NO_ERROR) {
// do not accept frame count changes if tracks are open as the track buffer
- // size depends on frame count and correct behavior would not be garantied
+ // size depends on frame count and correct behavior would not be guaranteed
// if frame count is changed after track creation
if (mActiveTrack != 0) {
status = INVALID_OPERATION;
@@ -6107,7 +6110,6 @@ status_t AudioFlinger::EffectModule::addHandle(const sp<EffectHandle>& handle)
status_t status;
Mutex::Autolock _l(mLock);
- // First handle in mHandles has highest priority and controls the effect module
int priority = handle->priority();
size_t size = mHandles.size();
sp<EffectHandle> h;
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index aa0ee76..48a23fa 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -1,4 +1,4 @@
-/* //device/include/server/AudioFlinger/AudioFlinger.h
+/*
**
** Copyright 2007, The Android Open Source Project
**
@@ -290,6 +290,8 @@ private:
enum track_state {
IDLE,
TERMINATED,
+ // These are order-sensitive; do not change order without reviewing the impact.
+ // In particular there are assumptions about > STOPPED.
STOPPED,
RESUMING,
ACTIVE,
@@ -760,6 +762,9 @@ private:
int mSuspended;
int mBytesWritten;
private:
+ // mMasterMute is in both PlaybackThread and in AudioFlinger. When a
+ // PlaybackThread needs to find out if master-muted, it checks it's local
+ // copy rather than the one in AudioFlinger. This optimization saves a lock.
bool mMasterMute;
protected:
SortedVector< wp<Track> > mActiveTracks;
@@ -853,6 +858,8 @@ private:
private:
void applyVolume(uint16_t leftVol, uint16_t rightVol, bool ramp);
+ // volumes last sent to audio HAL with stream->set_volume()
+ // FIXME use standard representation and names
float mLeftVolFloat;
float mRightVolFloat;
uint16_t mLeftVolShort;
@@ -900,6 +907,7 @@ private:
friend class AudioBuffer;
+ // server side of the client's IAudioTrack
class TrackHandle : public android::BnAudioTrack {
public:
TrackHandle(const sp<PlaybackThread::Track>& track);
@@ -1024,6 +1032,7 @@ private:
ssize_t mBytesRead;
};
+ // server side of the client's IAudioRecord
class RecordHandle : public android::BnAudioRecord {
public:
RecordHandle(const sp<RecordThread::RecordTrack>& recordTrack);
@@ -1152,6 +1161,7 @@ mutable Mutex mLock; // mutex for process, commands and handl
status_t mStatus; // initialization status
effect_state mState; // current activation state
Vector< wp<EffectHandle> > mHandles; // list of client handles
+ // First handle in mHandles has highest priority and controls the effect module
uint32_t mMaxDisableWaitCnt; // maximum grace period before forcing an effect off after
// sending disable command.
uint32_t mDisableWaitCnt; // current process() calls count during disable period.
@@ -1377,6 +1387,7 @@ mutable Mutex mLock; // mutex for process, commands and handl
hwDev(dev), stream(in) {}
};
+ // for mAudioSessionRefs only
struct AudioSessionRef {
// FIXME rename parameter names when fields get "m" prefix
AudioSessionRef(int sessionid_, pid_t pid_) :
@@ -1432,10 +1443,11 @@ mutable Mutex mLock; // mutex for process, commands and handl
DefaultKeyedVector< audio_io_handle_t, sp<RecordThread> > mRecordThreads;
DefaultKeyedVector< pid_t, sp<NotificationClient> > mNotificationClients;
- volatile int32_t mNextUniqueId;
+ volatile int32_t mNextUniqueId; // updated by android_atomic_inc
audio_mode_t mMode;
bool mBtNrecIsOff;
+ // protected by mLock
Vector<AudioSessionRef*> mAudioSessionRefs;
float masterVolume_l() const { return mMasterVolume; }
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 191520a..cb7678b 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -1,4 +1,4 @@
-/* //device/include/server/AudioFlinger/AudioMixer.cpp
+/*
**
** Copyright 2007, The Android Open Source Project
**
@@ -961,7 +961,12 @@ void AudioMixer::process__genericResampling(state_t* state)
// one track, 16 bits stereo without resampling is the most common case
void AudioMixer::process__OneTrack16BitsStereoNoResampling(state_t* state)
{
+ // This method is only called when state->enabledTracks has exactly
+ // one bit set. The asserts below would verify this, but are commented out
+ // since the whole point of this method is to optimize performance.
+ //assert(0 != state->enabledTracks);
const int i = 31 - __builtin_clz(state->enabledTracks);
+ //assert((1 << i) == state->enabledTracks);
const track_t& t = state->tracks[i];
AudioBufferProvider::Buffer& b(t.buffer);
diff --git a/services/audioflinger/AudioMixer.h b/services/audioflinger/AudioMixer.h
index c709686..c956918 100644
--- a/services/audioflinger/AudioMixer.h
+++ b/services/audioflinger/AudioMixer.h
@@ -1,4 +1,4 @@
-/* //device/include/server/AudioFlinger/AudioMixer.h
+/*
**
** Copyright 2007, The Android Open Source Project
**