summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-04-30 16:54:30 -0700
committerGlenn Kasten <gkasten@google.com>2014-05-02 11:52:56 -0700
commitc4b88a8d0f524666bf0f390075c334d047a104f2 (patch)
treea2d45172a9d794b8b626ed9acadb656e346b2e9c
parentb53fc4ef8da47df8d5f580e8ee6135866ffebc33 (diff)
downloadframeworks_av-c4b88a8d0f524666bf0f390075c334d047a104f2.zip
frameworks_av-c4b88a8d0f524666bf0f390075c334d047a104f2.tar.gz
frameworks_av-c4b88a8d0f524666bf0f390075c334d047a104f2.tar.bz2
Fix bug for direct track with PCM != 16-bit
The AUDIO_FORMAT_PCM_8_BIT format was being converted to AUDIO_FORMAT_PCM_16_BIT on client side even for direct tracks. That conversion was incorrect; it should only be done for mixed tracks. Also remove checks for specific PCM formats in the generic part of server side of createTrack. Those format checks should only be done by the thread. This will allow direct tracks for PCM 8-bit, PCM 24-bit, etc. Change-Id: If5b9fd79f8642ed93e2aeabcaf4809b2ed798978
-rw-r--r--media/libmedia/AudioTrack.cpp3
-rw-r--r--services/audioflinger/AudioFlinger.cpp6
2 files changed, 4 insertions, 5 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 8daf08b..dc4f90e 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -1005,7 +1005,8 @@ status_t AudioTrack::createTrack_l(size_t epoch)
sp<IAudioTrack> track = audioFlinger->createTrack(mStreamType,
mSampleRate,
// AudioFlinger only sees 16-bit PCM
- mFormat == AUDIO_FORMAT_PCM_8_BIT ?
+ mFormat == AUDIO_FORMAT_PCM_8_BIT &&
+ !(mFlags & AUDIO_OUTPUT_FLAG_DIRECT) ?
AUDIO_FORMAT_PCM_16_BIT : mFormat,
mChannelMask,
&temp,
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 755d480..eb00c82 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -541,10 +541,8 @@ sp<IAudioTrack> AudioFlinger::createTrack(
goto Exit;
}
- // client is responsible for conversion of 8-bit PCM to 16-bit PCM,
- // and we don't yet support 8.24 or 32-bit PCM
- if (!audio_is_valid_format(format) ||
- (audio_is_linear_pcm(format) && format != AUDIO_FORMAT_PCM_16_BIT)) {
+ // further format checks are performed by createTrack_l() depending on the thread type
+ if (!audio_is_valid_format(format)) {
ALOGE("createTrack() invalid format %#x", format);
lStatus = BAD_VALUE;
goto Exit;