summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Burk <philburk@google.com>2015-04-30 16:08:10 -0700
committerPhil Burk <philburk@google.com>2015-05-01 17:17:44 -0700
commit6fc2a7c81f62b1e21487ae37e11aae6241bc3ead (patch)
tree2b8396ccca007dfb36b825df49d4a430b3dd3d1c
parent1de1e25cba872bd4c077c2e394f8ca9c70b65856 (diff)
downloadframeworks_av-6fc2a7c81f62b1e21487ae37e11aae6241bc3ead.zip
frameworks_av-6fc2a7c81f62b1e21487ae37e11aae6241bc3ead.tar.gz
frameworks_av-6fc2a7c81f62b1e21487ae37e11aae6241bc3ead.tar.bz2
AudioTrack: fix direct tracks not pausing
When a Direct Track is paused and the HAL does not support pause() and resume() then the HW never gets paused. The app can just keep writing data, which gets played. Bug: 18899620 Change-Id: Ice0f360956ff7ca425f6f24a0a2a8640d8b43fa8 Signed-off-by: Phil Burk <philburk@google.com>
-rw-r--r--services/audioflinger/Threads.cpp17
-rw-r--r--services/audioflinger/Threads.h5
2 files changed, 12 insertions, 10 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 234e45f..1ca89a8 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -2055,6 +2055,9 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l()
ALOGW("direct output implements resume but not pause");
}
}
+ if (!mHwSupportsPause && mOutput->flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC) {
+ LOG_ALWAYS_FATAL("HW_AV_SYNC requested but HAL does not implement pause and resume");
+ }
if (mType == DUPLICATING && mMixerBufferEnabled && mEffectBufferEnabled) {
// For best precision, we use float instead of the associated output
@@ -4375,9 +4378,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep
sp<Track> l = mLatestActiveTrack.promote();
bool last = l.get() == track;
- if (mHwSupportsPause && track->isPausing()) {
+ if (track->isPausing()) {
track->setPaused();
- if (last && !mHwPaused) {
+ if (mHwSupportsPause && last && !mHwPaused) {
doHwPause = true;
mHwPaused = true;
}
@@ -4387,13 +4390,11 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep
if (last) {
flushPending = true;
}
- } else if (mHwSupportsPause && track->isResumePending()){
+ } else if (track->isResumePending()) {
track->resumeAck();
- if (last) {
- if (mHwPaused) {
- doHwResume = true;
- mHwPaused = false;
- }
+ if (last && mHwPaused) {
+ doHwResume = true;
+ mHwPaused = false;
}
}
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 2c514f8..3898532 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -713,8 +713,9 @@ protected:
audio_patch_handle_t *handle);
virtual status_t releaseAudioPatch_l(const audio_patch_handle_t handle);
- bool usesHwAvSync() const { return (mType == DIRECT) && (mOutput != NULL) &&
- (mOutput->flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC); }
+ bool usesHwAvSync() const { return (mType == DIRECT) && (mOutput != NULL)
+ && mHwSupportsPause
+ && (mOutput->flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC); }
private: