diff options
author | Haynes Mathew George <hgeorge@codeaurora.org> | 2014-11-20 11:32:27 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-11-20 13:04:15 -0800 |
commit | ec0eeafa8a7fd882e8206e9cf8c4c7e1db81857b (patch) | |
tree | a40aab7cb04a88cc63a45cffa376ec12ce5bc3b9 /services/audioflinger | |
parent | ec9459c63d1c2969505ffdc4a100646fd07223bd (diff) | |
download | frameworks_av-ec0eeafa8a7fd882e8206e9cf8c4c7e1db81857b.zip frameworks_av-ec0eeafa8a7fd882e8206e9cf8c4c7e1db81857b.tar.gz frameworks_av-ec0eeafa8a7fd882e8206e9cf8c4c7e1db81857b.tar.bz2 |
Fix format conversion in DuplicatingThread
DuplicatingThread converts PCM data from the format of the source thread
to PCM_16BIT before writing to all connected output tracks.
This needs to be done just once before writing to all tracks.
Bug: 18461844
Change-Id: If05254f87f9198e09a0fa3c4e857afbb53ae7073
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/Threads.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 71a6a73..0f11b34 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -4694,15 +4694,15 @@ void AudioFlinger::DuplicatingThread::threadLoop_sleepTime() ssize_t AudioFlinger::DuplicatingThread::threadLoop_write() { + // We convert the duplicating thread format to AUDIO_FORMAT_PCM_16_BIT + // for delivery downstream as needed. This in-place conversion is safe as + // AUDIO_FORMAT_PCM_16_BIT is smaller than any other supported format + // (AUDIO_FORMAT_PCM_8_BIT is not allowed here). + if (mFormat != AUDIO_FORMAT_PCM_16_BIT) { + memcpy_by_audio_format(mSinkBuffer, AUDIO_FORMAT_PCM_16_BIT, + mSinkBuffer, mFormat, writeFrames * mChannelCount); + } for (size_t i = 0; i < outputTracks.size(); i++) { - // We convert the duplicating thread format to AUDIO_FORMAT_PCM_16_BIT - // for delivery downstream as needed. This in-place conversion is safe as - // AUDIO_FORMAT_PCM_16_BIT is smaller than any other supported format - // (AUDIO_FORMAT_PCM_8_BIT is not allowed here). - if (mFormat != AUDIO_FORMAT_PCM_16_BIT) { - memcpy_by_audio_format(mSinkBuffer, AUDIO_FORMAT_PCM_16_BIT, - mSinkBuffer, mFormat, writeFrames * mChannelCount); - } outputTracks[i]->write(reinterpret_cast<int16_t*>(mSinkBuffer), writeFrames); } mStandby = false; |