summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-01-11 09:48:27 -0800
committerGlenn Kasten <gkasten@google.com>2012-01-13 14:58:44 -0800
commitb9980659501d0428d65d8292f3c32da69d37fbd2 (patch)
tree8b703aca299f4f715a65d07cc37b753e9753a941 /include
parentf4e76c538f81068bc2e125f3f9ef8b8dd40f2d2a (diff)
downloadframeworks_av-b9980659501d0428d65d8292f3c32da69d37fbd2.zip
frameworks_av-b9980659501d0428d65d8292f3c32da69d37fbd2.tar.gz
frameworks_av-b9980659501d0428d65d8292f3c32da69d37fbd2.tar.bz2
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
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioRecord.h2
-rw-r--r--include/media/AudioTrack.h7
-rw-r--r--include/private/media/AudioTrackShared.h2
3 files changed, 8 insertions, 3 deletions
diff --git a/include/media/AudioRecord.h b/include/media/AudioRecord.h
index 2fb69b6..84a8f1c 100644
--- a/include/media/AudioRecord.h
+++ b/include/media/AudioRecord.h
@@ -206,7 +206,7 @@ public:
int channelCount() const;
int channels() const;
uint32_t frameCount() const;
- int frameSize() const;
+ size_t frameSize() const;
int inputSource() const;
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 60b052b..01a9d05 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -219,7 +219,12 @@ public:
audio_format_t format() const;
int channelCount() const;
uint32_t frameCount() const;
- int frameSize() const;
+
+ /* Return channelCount * (bit depth per channel / 8).
+ * channelCount is determined from channelMask, and bit depth comes from format.
+ */
+ size_t frameSize() const;
+
sp<IMemory>& sharedBuffer();
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index 046d5e9..b661cb9 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -80,7 +80,7 @@ struct audio_track_cblk_t
// 8 bit PCM data: in this case, mCblk->frameSize is based on a sample size of
// 16 bit because data is converted to 16 bit before being stored in buffer
- uint8_t frameSize;
+ uint8_t frameSize; // would normally be size_t, but 8 bits is plenty
uint8_t pad1;
uint16_t bufferTimeoutMs; // Maximum cumulated timeout before restarting audioflinger