diff options
author | Andy Hung <hunga@google.com> | 2015-01-16 11:05:32 -0800 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2015-01-22 13:48:03 -0800 |
commit | 5bedff60b2facaa1ec5b9433647ebf1504f065ca (patch) | |
tree | d9d22703626906b38ee1f5c571f21f49ce447199 /services/audioflinger/Tracks.cpp | |
parent | 7790a33241f773d8a99c6f27d3bde36da08d6238 (diff) | |
download | frameworks_av-5bedff60b2facaa1ec5b9433647ebf1504f065ca.zip frameworks_av-5bedff60b2facaa1ec5b9433647ebf1504f065ca.tar.gz frameworks_av-5bedff60b2facaa1ec5b9433647ebf1504f065ca.tar.bz2 |
Do not pre-fill OutputTrack buffer for duplicating thread
It is not necessary to start the downstream MixerThread early,
rather allow stop() to flush the remaining frames.
Change-Id: Ibcf8e7f5eda09d0f915d50697ff0c24c32fd11c4
Diffstat (limited to 'services/audioflinger/Tracks.cpp')
-rw-r--r-- | services/audioflinger/Tracks.cpp | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp index 7757ea2..37c1c0b 100644 --- a/services/audioflinger/Tracks.cpp +++ b/services/audioflinger/Tracks.cpp @@ -1721,28 +1721,7 @@ bool AudioFlinger::PlaybackThread::OutputTrack::write(void* data, uint32_t frame uint32_t waitTimeLeftMs = mSourceThread->waitTimeMs(); if (!mActive && frames != 0) { - start(); - sp<ThreadBase> thread = mThread.promote(); - if (thread != 0) { - MixerThread *mixerThread = (MixerThread *)thread.get(); - if (mFrameCount > frames) { - // For the first write after being inactive, ensure that we have - // enough frames to fill mFrameCount (which should be multiples of - // the minimum buffer requirements of the downstream MixerThread). - // This provides enough frames for the downstream mixer to begin - // (see AudioFlinger::PlaybackThread::Track::isReady()). - if (mBufferQueue.size() < kMaxOverFlowBuffers) { - uint32_t startFrames = (mFrameCount - frames); - pInBuffer = new Buffer; - pInBuffer->mBuffer = calloc(1, startFrames * mFrameSize); - pInBuffer->frameCount = startFrames; - pInBuffer->raw = pInBuffer->mBuffer; - mBufferQueue.add(pInBuffer); - } else { - ALOGW("OutputTrack::write() %p no more buffers in queue", this); - } - } - } + (void) start(); } while (waitTimeLeftMs) { |