summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-02-28 10:39:56 -0800
committerGlenn Kasten <gkasten@google.com>2012-04-22 14:50:01 -0700
commit3acbd053c842e76e1a40fc8a0bf62de87eebf00f (patch)
tree1d6dcc01039a1af770131c6b427efa27a2e5755f /include
parentf853499c6a088ef8506cacbb3ccdffa87e0cec3e (diff)
downloadframeworks_av-3acbd053c842e76e1a40fc8a0bf62de87eebf00f.zip
frameworks_av-3acbd053c842e76e1a40fc8a0bf62de87eebf00f.tar.gz
frameworks_av-3acbd053c842e76e1a40fc8a0bf62de87eebf00f.tar.bz2
Configure policy of mediaserver threads
Change-Id: Ifd825590ba36996064a458f64453a94b84722cb0
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioTrack.h14
-rw-r--r--include/media/IAudioFlinger.h1
-rw-r--r--include/media/IAudioRecord.h5
-rw-r--r--include/media/IAudioTrack.h5
-rw-r--r--include/private/media/AudioTrackShared.h1
5 files changed, 19 insertions, 7 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 4906bd3..98b1f3e 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -138,7 +138,7 @@ public:
* frameCount: Minimum size of track PCM buffer in frames. This defines the
* latency of the track. The actual size selected by the AudioTrack could be
* larger if the requested size is not compatible with current audio HAL
- * latency.
+ * latency. Zero means to use a default value.
* flags: See comments on audio_output_flags_t in <system/audio.h>.
* cbf: Callback function. If not null, this function is called periodically
* to request new PCM data.
@@ -460,12 +460,24 @@ protected:
{
public:
AudioTrackThread(AudioTrack& receiver, bool bCanCallJava = false);
+
+ // Do not call Thread::requestExitAndWait() without first calling requestExit().
+ // Thread::requestExitAndWait() is not virtual, and the implementation doesn't do enough.
+ virtual void requestExit();
+
+ void pause(); // suspend thread from execution at next loop boundary
+ void resume(); // allow thread to execute, if not requested to exit
+
private:
friend class AudioTrack;
virtual bool threadLoop();
virtual status_t readyToRun();
virtual void onFirstRef();
AudioTrack& mReceiver;
+ ~AudioTrackThread();
+ Mutex mMyLock; // Thread::mLock is private
+ Condition mMyCond; // Thread::mThreadExitedCondition is private
+ bool mPaused; // whether thread is currently paused
};
// body of AudioTrackThread::threadLoop()
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 04ac3ee..86e228b 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -65,6 +65,7 @@ public:
track_flags_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
+ pid_t tid, // -1 means unused, otherwise must be valid non-0
int *sessionId,
status_t *status) = 0;
diff --git a/include/media/IAudioRecord.h b/include/media/IAudioRecord.h
index c486c6b..ebc03ea 100644
--- a/include/media/IAudioRecord.h
+++ b/include/media/IAudioRecord.h
@@ -35,10 +35,9 @@ public:
DECLARE_META_INTERFACE(AudioRecord);
/* After it's created the track is not active. Call start() to
- * make it active. If set, the callback will start being called.
- * tid identifies the client callback thread, or 0 if not needed.
+ * make it active.
*/
- virtual status_t start(pid_t tid, int event, int triggerSession) = 0;
+ virtual status_t start(int event, int triggerSession) = 0;
/* Stop a track. If set, the callback will cease being called and
* obtainBuffer will return an error. Buffers that are already released
diff --git a/include/media/IAudioTrack.h b/include/media/IAudioTrack.h
index 577b095..9e0e389 100644
--- a/include/media/IAudioTrack.h
+++ b/include/media/IAudioTrack.h
@@ -39,10 +39,9 @@ public:
virtual sp<IMemory> getCblk() const = 0;
/* After it's created the track is not active. Call start() to
- * make it active. If set, the callback will start being called.
- * tid identifies the client callback thread, or 0 if not needed.
+ * make it active.
*/
- virtual status_t start(pid_t tid) = 0;
+ virtual status_t start() = 0;
/* Stop a track. If set, the callback will cease being called and
* obtainBuffer will return an error. Buffers that are already released
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index af2db93..469f5ff 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -53,6 +53,7 @@ namespace android {
#define CBLK_RESTORED_MSK 0x0040
#define CBLK_RESTORED_ON 0x0040 // track has been restored after invalidation
#define CBLK_RESTORED_OFF 0x0040 // by AudioFlinger
+#define CBLK_FAST 0x0080 // AudioFlinger successfully created a fast track
// Important: do not add any virtual methods, including ~
struct audio_track_cblk_t