summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioRecord.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-11-14 12:54:39 -0800
committerGlenn Kasten <gkasten@google.com>2012-11-15 16:43:40 -0800
commite33054eb968cbf8ccaee1b0ff0301403902deed6 (patch)
treeb91f7abd2927e25a4cb7c50a8ef197c643ca9db6 /media/libmedia/AudioRecord.cpp
parent7d9c126be8dfe3016683eeb2b7a2d88ba5b24c0b (diff)
downloadframeworks_av-e33054eb968cbf8ccaee1b0ff0301403902deed6.zip
frameworks_av-e33054eb968cbf8ccaee1b0ff0301403902deed6.tar.gz
frameworks_av-e33054eb968cbf8ccaee1b0ff0301403902deed6.tar.bz2
Use size_t for frame counts
Also fix typo: bufferCount should be frameCount. Change-Id: Ibed539504db75ef99dc21c8ff1bf2987122063a5
Diffstat (limited to 'media/libmedia/AudioRecord.cpp')
-rw-r--r--media/libmedia/AudioRecord.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index 8f45a57..0587651 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -36,7 +36,7 @@ namespace android {
// static
status_t AudioRecord::getMinFrameCount(
- int* frameCount,
+ size_t* frameCount,
uint32_t sampleRate,
audio_format_t format,
audio_channel_mask_t channelMask)
@@ -119,15 +119,21 @@ status_t AudioRecord::set(
uint32_t sampleRate,
audio_format_t format,
audio_channel_mask_t channelMask,
- int frameCount,
+ int frameCountInt,
callback_t cbf,
void* user,
int notificationFrames,
bool threadCanCallJava,
int sessionId)
{
+ // FIXME "int" here is legacy and will be replaced by size_t later
+ if (frameCountInt < 0) {
+ ALOGE("Invalid frame count %d", frameCountInt);
+ return BAD_VALUE;
+ }
+ size_t frameCount = frameCountInt;
- ALOGV("set(): sampleRate %u, channelMask %#x, frameCount %d", sampleRate, channelMask,
+ ALOGV("set(): sampleRate %u, channelMask %#x, frameCount %u", sampleRate, channelMask,
frameCount);
AutoMutex lock(mLock);
@@ -177,7 +183,7 @@ status_t AudioRecord::set(
}
// validate framecount
- int minFrameCount = 0;
+ size_t minFrameCount = 0;
status_t status = getMinFrameCount(&minFrameCount, sampleRate, format, channelMask);
if (status != NO_ERROR) {
return status;
@@ -260,7 +266,7 @@ int AudioRecord::channelCount() const
return mChannelCount;
}
-uint32_t AudioRecord::frameCount() const
+size_t AudioRecord::frameCount() const
{
return mFrameCount;
}
@@ -427,7 +433,7 @@ status_t AudioRecord::openRecord_l(
uint32_t sampleRate,
audio_format_t format,
audio_channel_mask_t channelMask,
- int frameCount,
+ size_t frameCount,
audio_io_handle_t input)
{
status_t status;