Loading services/audioflinger/AudioFlinger.cpp +16 −3 Original line number Diff line number Diff line Loading @@ -1621,6 +1621,19 @@ audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module, mHardwareStatus = AUDIO_HW_OUTPUT_OPEN; audio_stream_out_t *outStream = NULL; // FOR TESTING ONLY: // Enable increased sink precision for mixing mode if kEnableExtendedPrecision is true. if (kEnableExtendedPrecision && // Check only for Normal Mixing mode !(flags & (AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD | AUDIO_OUTPUT_FLAG_DIRECT))) { // Update format //config.format = AUDIO_FORMAT_PCM_FLOAT; //config.format = AUDIO_FORMAT_PCM_24_BIT_PACKED; //config.format = AUDIO_FORMAT_PCM_32_BIT; //config.format = AUDIO_FORMAT_PCM_8_24_BIT; // ALOGV("openOutput() upgrading format to %#08x", config.format); } status_t status = hwDevHal->open_output_stream(hwDevHal, id, *pDevices, Loading @@ -1644,9 +1657,9 @@ audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module, if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { thread = new OffloadThread(this, output, id, *pDevices); ALOGV("openOutput() created offload output: ID %d thread %p", id, thread); } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) || (config.format != AUDIO_FORMAT_PCM_16_BIT) || (config.channel_mask != AUDIO_CHANNEL_OUT_STEREO)) { } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) || !isValidPcmSinkFormat(config.format) || (config.channel_mask != AUDIO_CHANNEL_OUT_STEREO)) { thread = new DirectOutputThread(this, output, id, *pDevices); ALOGV("openOutput() created direct output: ID %d thread %p", id, thread); } else { Loading services/audioflinger/AudioFlinger.h +18 −0 Original line number Diff line number Diff line Loading @@ -326,6 +326,24 @@ private: audio_devices_t devices); void purgeStaleEffects_l(); // Set kEnableExtendedPrecision to true to use extended precision in MixerThread static const bool kEnableExtendedPrecision = false; // Returns true if format is permitted for the PCM sink in the MixerThread static inline bool isValidPcmSinkFormat(audio_format_t format) { switch (format) { case AUDIO_FORMAT_PCM_16_BIT: return true; case AUDIO_FORMAT_PCM_FLOAT: case AUDIO_FORMAT_PCM_24_BIT_PACKED: case AUDIO_FORMAT_PCM_32_BIT: case AUDIO_FORMAT_PCM_8_24_BIT: return kEnableExtendedPrecision; default: return false; } } // standby delay for MIXER and DUPLICATING playback threads is read from property // ro.audio.flinger_standbytime_ms or defaults to kDefaultStandbyTimeInNsecs static nsecs_t mStandbyTimeInNsecs; Loading services/audioflinger/Threads.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -1157,12 +1157,12 @@ AudioFlinger::PlaybackThread::PlaybackThread(const sp<AudioFlinger>& audioFlinge type_t type) : ThreadBase(audioFlinger, id, device, AUDIO_DEVICE_NONE, type), mNormalFrameCount(0), mSinkBuffer(NULL), mMixerBufferEnabled(false), mMixerBufferEnabled(AudioFlinger::kEnableExtendedPrecision), mMixerBuffer(NULL), mMixerBufferSize(0), mMixerBufferFormat(AUDIO_FORMAT_INVALID), mMixerBufferValid(false), mEffectBufferEnabled(false), mEffectBufferEnabled(AudioFlinger::kEnableExtendedPrecision), mEffectBuffer(NULL), mEffectBufferSize(0), mEffectBufferFormat(AUDIO_FORMAT_INVALID), Loading Loading @@ -1401,9 +1401,10 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac frameCount, mFrameCount); } else { ALOGV("AUDIO_OUTPUT_FLAG_FAST denied: isTimed=%d sharedBuffer=%p frameCount=%d " "mFrameCount=%d format=%d isLinear=%d channelMask=%#x sampleRate=%u mSampleRate=%u " "mFrameCount=%d format=%#x mFormat=%#x isLinear=%d channelMask=%#x " "sampleRate=%u mSampleRate=%u " "hasFastMixer=%d tid=%d fastTrackAvailMask=%#x", isTimed, sharedBuffer.get(), frameCount, mFrameCount, format, isTimed, sharedBuffer.get(), frameCount, mFrameCount, format, mFormat, audio_is_linear_pcm(format), channelMask, sampleRate, mSampleRate, hasFastMixer(), tid, mFastTrackAvailMask); *flags &= ~IAudioFlinger::TRACK_FAST; Loading Loading @@ -1809,9 +1810,10 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l() if (!audio_is_valid_format(mFormat)) { LOG_ALWAYS_FATAL("HAL format %#x not valid for output", mFormat); } if ((mType == MIXER || mType == DUPLICATING) && mFormat != AUDIO_FORMAT_PCM_16_BIT) { LOG_ALWAYS_FATAL("HAL format %#x not supported for mixed output; " "must be AUDIO_FORMAT_PCM_16_BIT", mFormat); if ((mType == MIXER || mType == DUPLICATING) && !isValidPcmSinkFormat(mFormat)) { LOG_FATAL("HAL format %#x not supported for mixed output", mFormat); } mFrameSize = audio_stream_frame_size(&mOutput->stream->common); mBufferSize = mOutput->stream->common.get_buffer_size(&mOutput->stream->common); Loading Loading
services/audioflinger/AudioFlinger.cpp +16 −3 Original line number Diff line number Diff line Loading @@ -1621,6 +1621,19 @@ audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module, mHardwareStatus = AUDIO_HW_OUTPUT_OPEN; audio_stream_out_t *outStream = NULL; // FOR TESTING ONLY: // Enable increased sink precision for mixing mode if kEnableExtendedPrecision is true. if (kEnableExtendedPrecision && // Check only for Normal Mixing mode !(flags & (AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD | AUDIO_OUTPUT_FLAG_DIRECT))) { // Update format //config.format = AUDIO_FORMAT_PCM_FLOAT; //config.format = AUDIO_FORMAT_PCM_24_BIT_PACKED; //config.format = AUDIO_FORMAT_PCM_32_BIT; //config.format = AUDIO_FORMAT_PCM_8_24_BIT; // ALOGV("openOutput() upgrading format to %#08x", config.format); } status_t status = hwDevHal->open_output_stream(hwDevHal, id, *pDevices, Loading @@ -1644,9 +1657,9 @@ audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module, if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { thread = new OffloadThread(this, output, id, *pDevices); ALOGV("openOutput() created offload output: ID %d thread %p", id, thread); } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) || (config.format != AUDIO_FORMAT_PCM_16_BIT) || (config.channel_mask != AUDIO_CHANNEL_OUT_STEREO)) { } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) || !isValidPcmSinkFormat(config.format) || (config.channel_mask != AUDIO_CHANNEL_OUT_STEREO)) { thread = new DirectOutputThread(this, output, id, *pDevices); ALOGV("openOutput() created direct output: ID %d thread %p", id, thread); } else { Loading
services/audioflinger/AudioFlinger.h +18 −0 Original line number Diff line number Diff line Loading @@ -326,6 +326,24 @@ private: audio_devices_t devices); void purgeStaleEffects_l(); // Set kEnableExtendedPrecision to true to use extended precision in MixerThread static const bool kEnableExtendedPrecision = false; // Returns true if format is permitted for the PCM sink in the MixerThread static inline bool isValidPcmSinkFormat(audio_format_t format) { switch (format) { case AUDIO_FORMAT_PCM_16_BIT: return true; case AUDIO_FORMAT_PCM_FLOAT: case AUDIO_FORMAT_PCM_24_BIT_PACKED: case AUDIO_FORMAT_PCM_32_BIT: case AUDIO_FORMAT_PCM_8_24_BIT: return kEnableExtendedPrecision; default: return false; } } // standby delay for MIXER and DUPLICATING playback threads is read from property // ro.audio.flinger_standbytime_ms or defaults to kDefaultStandbyTimeInNsecs static nsecs_t mStandbyTimeInNsecs; Loading
services/audioflinger/Threads.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -1157,12 +1157,12 @@ AudioFlinger::PlaybackThread::PlaybackThread(const sp<AudioFlinger>& audioFlinge type_t type) : ThreadBase(audioFlinger, id, device, AUDIO_DEVICE_NONE, type), mNormalFrameCount(0), mSinkBuffer(NULL), mMixerBufferEnabled(false), mMixerBufferEnabled(AudioFlinger::kEnableExtendedPrecision), mMixerBuffer(NULL), mMixerBufferSize(0), mMixerBufferFormat(AUDIO_FORMAT_INVALID), mMixerBufferValid(false), mEffectBufferEnabled(false), mEffectBufferEnabled(AudioFlinger::kEnableExtendedPrecision), mEffectBuffer(NULL), mEffectBufferSize(0), mEffectBufferFormat(AUDIO_FORMAT_INVALID), Loading Loading @@ -1401,9 +1401,10 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac frameCount, mFrameCount); } else { ALOGV("AUDIO_OUTPUT_FLAG_FAST denied: isTimed=%d sharedBuffer=%p frameCount=%d " "mFrameCount=%d format=%d isLinear=%d channelMask=%#x sampleRate=%u mSampleRate=%u " "mFrameCount=%d format=%#x mFormat=%#x isLinear=%d channelMask=%#x " "sampleRate=%u mSampleRate=%u " "hasFastMixer=%d tid=%d fastTrackAvailMask=%#x", isTimed, sharedBuffer.get(), frameCount, mFrameCount, format, isTimed, sharedBuffer.get(), frameCount, mFrameCount, format, mFormat, audio_is_linear_pcm(format), channelMask, sampleRate, mSampleRate, hasFastMixer(), tid, mFastTrackAvailMask); *flags &= ~IAudioFlinger::TRACK_FAST; Loading Loading @@ -1809,9 +1810,10 @@ void AudioFlinger::PlaybackThread::readOutputParameters_l() if (!audio_is_valid_format(mFormat)) { LOG_ALWAYS_FATAL("HAL format %#x not valid for output", mFormat); } if ((mType == MIXER || mType == DUPLICATING) && mFormat != AUDIO_FORMAT_PCM_16_BIT) { LOG_ALWAYS_FATAL("HAL format %#x not supported for mixed output; " "must be AUDIO_FORMAT_PCM_16_BIT", mFormat); if ((mType == MIXER || mType == DUPLICATING) && !isValidPcmSinkFormat(mFormat)) { LOG_FATAL("HAL format %#x not supported for mixed output", mFormat); } mFrameSize = audio_stream_frame_size(&mOutput->stream->common); mBufferSize = mOutput->stream->common.get_buffer_size(&mOutput->stream->common); Loading