diff options
author | Eric Laurent <elaurent@google.com> | 2013-11-22 09:29:56 -0800 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2014-03-05 12:12:01 -0800 |
commit | 7e92abeafb184e8a34213d7149592e95a72601b0 (patch) | |
tree | 09ec6f7fdfdc0b9564660f134bd6a460a4480d85 | |
parent | 85b3013e06e8fe7802fe6259ecac80261e834332 (diff) | |
download | frameworks_av-7e92abeafb184e8a34213d7149592e95a72601b0.zip frameworks_av-7e92abeafb184e8a34213d7149592e95a72601b0.tar.gz frameworks_av-7e92abeafb184e8a34213d7149592e95a72601b0.tar.bz2 |
audioflinger: fix offload write buffer offset
Fix current audio HAL write buffer offset calculation
which assumes that the frame size is a multiple of 2.
'
Bug: 12823725.
Change-Id: I0195ed5cfef225a6f114e7dd405a02680bb7254e
-rw-r--r-- | services/audioflinger/Threads.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 110e45c..7cc6abe 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -1915,7 +1915,7 @@ ssize_t AudioFlinger::PlaybackThread::threadLoop_write() // otherwise use the HAL / AudioStreamOut directly } else { // Direct output and offload threads - size_t offset = (mCurrentWriteLength - mBytesRemaining) / sizeof(int16_t); + size_t offset = (mCurrentWriteLength - mBytesRemaining); if (mUseAsyncWrite) { ALOGW_IF(mWriteAckSequence & 1, "threadLoop_write(): out of sequence write request"); mWriteAckSequence += 2; @@ -1926,7 +1926,7 @@ ssize_t AudioFlinger::PlaybackThread::threadLoop_write() // FIXME We should have an implementation of timestamps for direct output threads. // They are used e.g for multichannel PCM playback over HDMI. bytesWritten = mOutput->stream->write(mOutput->stream, - mMixBuffer + offset, mBytesRemaining); + (char *)mMixBuffer + offset, mBytesRemaining); if (mUseAsyncWrite && ((bytesWritten < 0) || (bytesWritten == (ssize_t)mBytesRemaining))) { // do not wait for async callback in case of error of full write |