diff options
Diffstat (limited to 'media/libmedia/AudioRecord.cpp')
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index 263a7c7..b40aaf5 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -213,6 +213,13 @@ status_t AudioRecord::set( mFrameCount = mCblk->frameCount; mChannelCount = (uint8_t)channelCount; mChannelMask = channelMask; + + if (audio_is_linear_pcm(mFormat)) { + mFrameSize = channelCount * audio_bytes_per_sample(format); + } else { + mFrameSize = sizeof(uint8_t); + } + mActive = false; mCbf = cbf; mNotificationFrames = notificationFrames; @@ -258,15 +265,6 @@ uint32_t AudioRecord::frameCount() const return mFrameCount; } -size_t AudioRecord::frameSize() const -{ - if (audio_is_linear_pcm(mFormat)) { - return channelCount()*audio_bytes_per_sample(mFormat); - } else { - return sizeof(uint8_t); - } -} - audio_source_t AudioRecord::inputSource() const { return mInputSource; @@ -560,8 +558,8 @@ create_new_record: } audioBuffer->frameCount = framesReq; - audioBuffer->size = framesReq*cblk->frameSize; - audioBuffer->raw = cblk->buffer(mBuffers, u); + audioBuffer->size = framesReq * mFrameSize; + audioBuffer->raw = cblk->buffer(mBuffers, mFrameSize, u); active = mActive; return active ? status_t(NO_ERROR) : status_t(STOPPED); } |