support stereo/multichannel 24-bit format
kMaxFrameSize is fixed to 32768. When converting 24-bit to 16-bit,
number of samlpes is maxBytesToRead /3.
In this case, if the maxBytesToRead is not multiple of 3,
pcm data is messed when converting.
Bug:
7630939
Change-Id: I0ea1b53eb1272a8d83b63815fc0a05b73cef75f1
return err;
}
+ // make sure that maxBytesToRead is multiple of 3, in 24-bit case
size_t maxBytesToRead =
- mBitsPerSample == 8 ? kMaxFrameSize / 2 : kMaxFrameSize;
+ mBitsPerSample == 8 ? kMaxFrameSize / 2 :
+ (mBitsPerSample == 24 ? 3*(kMaxFrameSize/3): kMaxFrameSize);
size_t maxBytesAvailable =
(mCurrentPos - mOffset >= (off64_t)mSize)
buffer->set_range(0, n);
- if (mWaveFormat == WAVE_FORMAT_PCM) {
+ if (mWaveFormat == WAVE_FORMAT_PCM || mWaveFormat == WAVE_FORMAT_EXTENSIBLE) {
if (mBitsPerSample == 8) {
// Convert 8-bit unsigned samples to 16-bit signed.