diff options
author | Andy Hung <hunga@google.com> | 2014-07-11 00:11:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-10 21:28:08 +0000 |
commit | 8346bf5c2dd059c5451706ef1b906cb34d5175cd (patch) | |
tree | b842277d30861e2876a0e5eba1d3e1ca4c2e7769 /services | |
parent | eb062b5a6c98115f36af2dab8ede0efa4469825b (diff) | |
parent | 463be250de73907965faa6a216c00312bf81e049 (diff) | |
download | frameworks_av-8346bf5c2dd059c5451706ef1b906cb34d5175cd.zip frameworks_av-8346bf5c2dd059c5451706ef1b906cb34d5175cd.tar.gz frameworks_av-8346bf5c2dd059c5451706ef1b906cb34d5175cd.tar.bz2 |
Merge "Return negotiated format with HAL in AudioFlinger"
Diffstat (limited to 'services')
-rwxr-xr-x | services/audioflinger/Threads.cpp | 8 | ||||
-rw-r--r-- | services/audioflinger/Threads.h | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp index 11d13a8..decb985 100755 --- a/services/audioflinger/Threads.cpp +++ b/services/audioflinger/Threads.cpp @@ -586,7 +586,7 @@ void AudioFlinger::ThreadBase::dumpBase(int fd, const Vector<String16>& args __u dprintf(fd, " Channel Count: %u\n", mChannelCount); dprintf(fd, " Channel Mask: 0x%08x (%s)\n", mChannelMask, channelMaskToString(mChannelMask, mType != RECORD).string()); - dprintf(fd, " Format: 0x%x (%s)\n", mFormat, formatToString(mFormat)); + dprintf(fd, " Format: 0x%x (%s)\n", mHALFormat, formatToString(mHALFormat)); dprintf(fd, " Frame size: %zu\n", mFrameSize); dprintf(fd, " Pending config events:"); size_t numConfig = mConfigEvents.size(); @@ -1806,7 +1806,8 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l() "must be AUDIO_CHANNEL_OUT_STEREO", mChannelMask); } mChannelCount = audio_channel_count_from_out_mask(mChannelMask); - mFormat = mOutput->stream->common.get_format(&mOutput->stream->common); + mHALFormat = mOutput->stream->common.get_format(&mOutput->stream->common); + mFormat = mHALFormat; if (!audio_is_valid_format(mFormat)) { LOG_ALWAYS_FATAL("HAL format %#x not valid for output", mFormat); } @@ -6009,7 +6010,8 @@ void AudioFlinger::RecordThread::readInputParameters_l() mSampleRate = mInput->stream->common.get_sample_rate(&mInput->stream->common); mChannelMask = mInput->stream->common.get_channels(&mInput->stream->common); mChannelCount = audio_channel_count_from_in_mask(mChannelMask); - mFormat = mInput->stream->common.get_format(&mInput->stream->common); + mHALFormat = mInput->stream->common.get_format(&mInput->stream->common); + mFormat = mHALFormat; if (mFormat != AUDIO_FORMAT_PCM_16_BIT) { ALOGE("HAL format %#x not supported; must be AUDIO_FORMAT_PCM_16_BIT", mFormat); } diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h index c265833..3b7257b 100644 --- a/services/audioflinger/Threads.h +++ b/services/audioflinger/Threads.h @@ -234,7 +234,7 @@ public: // dynamic externally-visible uint32_t sampleRate() const { return mSampleRate; } audio_channel_mask_t channelMask() const { return mChannelMask; } - audio_format_t format() const { return mFormat; } + audio_format_t format() const { return mHALFormat; } // Called by AudioFlinger::frameCount(audio_io_handle_t output) and effects, // and returns the [normal mix] buffer's frame count. virtual size_t frameCount() const = 0; @@ -407,7 +407,11 @@ protected: audio_channel_mask_t mChannelMask; uint32_t mChannelCount; size_t mFrameSize; - audio_format_t mFormat; + audio_format_t mFormat; // Source format for Recording and + // Sink format for Playback. + // Sink format may be different than + // HAL format if Fastmixer is used. + audio_format_t mHALFormat; size_t mBufferSize; // HAL buffer size for read() or write() Vector< sp<ConfigEvent> > mConfigEvents; |