summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2011-06-23 08:08:20 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-23 08:08:20 -0700
commite2ac799dfcd01c9cbd9693890964b2bb5b8f4e88 (patch)
tree7cad7fba532565d5e2b9c8c1043c042df46be15b /media
parentafd2580afd62fb71da5ea0bec25feb8206be61d9 (diff)
parentc310dcbed66026fa548f9ec0821ec15f8c6a080d (diff)
downloadframeworks_base-e2ac799dfcd01c9cbd9693890964b2bb5b8f4e88.zip
frameworks_base-e2ac799dfcd01c9cbd9693890964b2bb5b8f4e88.tar.gz
frameworks_base-e2ac799dfcd01c9cbd9693890964b2bb5b8f4e88.tar.bz2
Merge "Added audio_bytes_per_sample() helper function"
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioRecord.cpp4
-rw-r--r--media/libmedia/AudioTrack.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index a41d7ab..03518bf 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -70,7 +70,7 @@ status_t AudioRecord::getMinFrameCount(
size <<= 1;
if (audio_is_linear_pcm(format)) {
- size /= channelCount * (format == AUDIO_FORMAT_PCM_16_BIT ? 2 : 1);
+ size /= channelCount * audio_bytes_per_sample(format);
}
*frameCount = size;
@@ -258,7 +258,7 @@ uint32_t AudioRecord::frameCount() const
int AudioRecord::frameSize() const
{
if (audio_is_linear_pcm(mFormat)) {
- return channelCount()*((format() == AUDIO_FORMAT_PCM_8_BIT) ? sizeof(uint8_t) : sizeof(int16_t));
+ return channelCount()*audio_bytes_per_sample(mFormat);
} else {
return sizeof(uint8_t);
}
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 37fe182..5172809 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -298,7 +298,7 @@ uint32_t AudioTrack::frameCount() const
int AudioTrack::frameSize() const
{
if (audio_is_linear_pcm(mFormat)) {
- return channelCount()*((format() == AUDIO_FORMAT_PCM_8_BIT) ? sizeof(uint8_t) : sizeof(int16_t));
+ return channelCount()*audio_bytes_per_sample(mFormat);
} else {
return sizeof(uint8_t);
}