summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrackShared.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-05-13 10:38:42 -0700
committerGlenn Kasten <gkasten@google.com>2014-06-02 11:30:29 -0700
commit6dbb5e3336cfff1ad51d429fcb847307c06efd61 (patch)
tree1918b6cde40e188641e729b6bbde39cce81085bd /media/libmedia/AudioTrackShared.cpp
parent4ea00a25cf85877b48ebd1e15a657cfaab29af58 (diff)
downloadframeworks_av-6dbb5e3336cfff1ad51d429fcb847307c06efd61.zip
frameworks_av-6dbb5e3336cfff1ad51d429fcb847307c06efd61.tar.gz
frameworks_av-6dbb5e3336cfff1ad51d429fcb847307c06efd61.tar.bz2
Use of fast capture by normal capture
Will only configure fast capture path if the input buffer size is less than 10 ms and the input sample rate is same as the primary output sample rate. Change-Id: I4a7cdc6069d750845412c626d27e83f72a1ab397
Diffstat (limited to 'media/libmedia/AudioTrackShared.cpp')
-rw-r--r--media/libmedia/AudioTrackShared.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/media/libmedia/AudioTrackShared.cpp b/media/libmedia/AudioTrackShared.cpp
index 219dbfd..0dbfa62 100644
--- a/media/libmedia/AudioTrackShared.cpp
+++ b/media/libmedia/AudioTrackShared.cpp
@@ -134,10 +134,17 @@ status_t ClientProxy::obtainBuffer(Buffer* buffer, const struct timespec *reques
ssize_t filled = rear - front;
// pipe should not be overfull
if (!(0 <= filled && (size_t) filled <= mFrameCount)) {
- ALOGE("Shared memory control block is corrupt (filled=%d); shutting down", filled);
- mIsShutdown = true;
- status = NO_INIT;
- goto end;
+ if (mIsOut) {
+ ALOGE("Shared memory control block is corrupt (filled=%d, mFrameCount=%u); "
+ "shutting down", filled, mFrameCount);
+ mIsShutdown = true;
+ status = NO_INIT;
+ goto end;
+ }
+ // for input, sync up on overrun
+ filled = 0;
+ cblk->u.mStreaming.mFront = rear;
+ (void) android_atomic_or(CBLK_OVERRUN, &cblk->mFlags);
}
// don't allow filling pipe beyond the nominal size
size_t avail = mIsOut ? mFrameCount - filled : filled;