Use size_t for frame size
except in the control block, where we don't have room.
In AudioFlinger::ThreadBase::TrackBase::getBuffer,
read the frame size from control block only once.
Change-Id: Id6c4bccd4ed3e07d91df6bbea43bae45524f9f4e
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 8e4a9d6..32b5bac 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -263,7 +263,7 @@
return mFrameCount;
}
-int AudioRecord::frameSize() const
+size_t AudioRecord::frameSize() const
{
if (audio_is_linear_pcm(mFormat)) {
return channelCount()*audio_bytes_per_sample(mFormat);
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 9c650ad..a66a1dd 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -295,7 +295,7 @@
return mCblk->frameCount;
}
-int AudioTrack::frameSize() const
+size_t AudioTrack::frameSize() const
{
if (audio_is_linear_pcm(mFormat)) {
return channelCount()*audio_bytes_per_sample(mFormat);
@@ -979,7 +979,7 @@
ssize_t written = 0;
const int8_t *src = (const int8_t *)buffer;
Buffer audioBuffer;
- size_t frameSz = (size_t)frameSize();
+ size_t frameSz = frameSize();
do {
audioBuffer.frameCount = userSize/frameSz;
@@ -1137,7 +1137,7 @@
audioBuffer.size = writtenSize;
// NOTE: mCblk->frameSize is not equal to AudioTrack::frameSize() for
- // 8 bit PCM data: in this case, mCblk->frameSize is based on a sampel size of
+ // 8 bit PCM data: in this case, mCblk->frameSize is based on a sample size of
// 16 bit.
audioBuffer.frameCount = writtenSize/mCblk->frameSize;