diff options
author | Andy Hung <hunga@google.com> | 2015-04-07 13:43:36 -0700 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2015-04-08 15:58:56 -0700 |
commit | 6770c6faa3467c92eabc5ec9b23d60eb556a0d03 (patch) | |
tree | 45470127b227dbda5a346bb1902f92f8998c25bb /services/audioflinger/Threads.cpp | |
parent | 73c02e4277b399c2ec1555d32b6ad5df23bb83dc (diff) | |
download | frameworks_av-6770c6faa3467c92eabc5ec9b23d60eb556a0d03.zip frameworks_av-6770c6faa3467c92eabc5ec9b23d60eb556a0d03.tar.gz frameworks_av-6770c6faa3467c92eabc5ec9b23d60eb556a0d03.tar.bz2 |
Enable 8 bit and float pcm record formats for AudioFlinger
Update sampling rate handling as well.
Bug: 19570772
Change-Id: I872248e64c0578b2e48869a68fee0d51bd0640c3
Diffstat (limited to 'services/audioflinger/Threads.cpp')
-rw-r--r-- | services/audioflinger/Threads.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index c096bdd..1a20fae 100644 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -86,7 +86,13 @@ #define ALOGVV(a...) do { } while(0) #endif +// TODO: Move these macro/inlines to a header file. #define max(a, b) ((a) > (b) ? (a) : (b)) +template <typename T> +static inline T min(const T& a, const T& b) +{ + return a < b ? a : b; +} namespace android { @@ -5622,6 +5628,13 @@ reacquire_wakelock: break; } + // Don't allow framesOut to be larger than what is possible with resampling + // from framesIn. + // This isn't strictly necessary but helps limit buffer resizing in + // RecordBufferConverter. TODO: remove when no longer needed. + framesOut = min(framesOut, + destinationFramesPossible( + framesIn, mSampleRate, activeTrack->mSampleRate)); // process frames from the RecordThread buffer provider to the RecordTrack buffer framesOut = activeTrack->mRecordBufferConverter->convert( activeTrack->mSink.raw, activeTrack->mResamplerBufferProvider, framesOut); |