diff options
author | Eric Laurent <elaurent@google.com> | 2011-06-23 08:08:20 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-23 08:08:20 -0700 |
commit | eddf9ef9235608e0231379a7bc614853bf5bcfa3 (patch) | |
tree | d62d9945ded6cba687b4f861b5511689f1ec272f | |
parent | 10774791af82faacb12307d3d7d79c80afc96574 (diff) | |
parent | 671a636931295d9c33ffca74551a804479d01241 (diff) | |
download | frameworks_av-eddf9ef9235608e0231379a7bc614853bf5bcfa3.zip frameworks_av-eddf9ef9235608e0231379a7bc614853bf5bcfa3.tar.gz frameworks_av-eddf9ef9235608e0231379a7bc614853bf5bcfa3.tar.bz2 |
Merge "Added audio_bytes_per_sample() helper function"
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 4 | ||||
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 2 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 2 |
3 files changed, 4 insertions, 4 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); } diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 44df5b5..f716e63 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -2936,7 +2936,7 @@ AudioFlinger::PlaybackThread::Track::Track( mStreamType = streamType; // NOTE: audio_track_cblk_t::frameSize for 8 bit PCM data is based on a sample size of // 16 bit because data is converted to 16 bit before being stored in buffer by AudioTrack - mCblk->frameSize = audio_is_linear_pcm(format) ? mChannelCount * sizeof(int16_t) : sizeof(int8_t); + mCblk->frameSize = audio_is_linear_pcm(format) ? mChannelCount * audio_bytes_per_sample(format) : sizeof(uint8_t); } } |