Loading services/audioflinger/AudioFlinger.cpp +4 −2 Original line number Original line Diff line number Diff line Loading @@ -2869,13 +2869,15 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo ALOGV("openOutput_l() created spatializer output: ID %d thread %p", ALOGV("openOutput_l() created spatializer output: ID %d thread %p", *output, thread.get()); *output, thread.get()); } else if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { } else if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { thread = new OffloadThread(this, outputStream, *output, mSystemReady); thread = new OffloadThread(this, outputStream, *output, mSystemReady, halConfig->offload_info); ALOGV("openOutput_l() created offload output: ID %d thread %p", ALOGV("openOutput_l() created offload output: ID %d thread %p", *output, thread.get()); *output, thread.get()); } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) || !isValidPcmSinkFormat(halConfig->format) || !isValidPcmSinkFormat(halConfig->format) || !isValidPcmSinkChannelMask(halConfig->channel_mask)) { || !isValidPcmSinkChannelMask(halConfig->channel_mask)) { thread = new DirectOutputThread(this, outputStream, *output, mSystemReady); thread = new DirectOutputThread(this, outputStream, *output, mSystemReady, halConfig->offload_info); ALOGV("openOutput_l() created direct output: ID %d thread %p", ALOGV("openOutput_l() created direct output: ID %d thread %p", *output, thread.get()); *output, thread.get()); } else { } else { Loading services/audioflinger/Threads.cpp +10 −5 Original line number Original line Diff line number Diff line Loading @@ -6143,8 +6143,10 @@ void AudioFlinger::MixerThread::cacheParameters_l() // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, ThreadBase::type_t type, bool systemReady) AudioStreamOut* output, audio_io_handle_t id, ThreadBase::type_t type, bool systemReady, const audio_offload_info_t& offloadInfo) : PlaybackThread(audioFlinger, output, id, type, systemReady) : PlaybackThread(audioFlinger, output, id, type, systemReady) , mOffloadInfo(offloadInfo) { { setMasterBalance(audioFlinger->getMasterBalance_l()); setMasterBalance(audioFlinger->getMasterBalance_l()); } } Loading Loading @@ -6423,7 +6425,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep // fill a buffer, then remove it from active list. // fill a buffer, then remove it from active list. // Only consider last track started for mixer state control // Only consider last track started for mixer state control bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); if (--(track->mRetryCount) <= 0) { if (!isTunerStream() // tuner streams remain active in underrun && --(track->mRetryCount) <= 0) { if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. track->mRetryCount = kMaxTrackRetriesOffload; track->mRetryCount = kMaxTrackRetriesOffload; } else { } else { Loading Loading @@ -6786,8 +6789,9 @@ void AudioFlinger::AsyncCallbackThread::setAsyncError() // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- AudioFlinger::OffloadThread::OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioFlinger::OffloadThread::OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, bool systemReady) AudioStreamOut* output, audio_io_handle_t id, bool systemReady, : DirectOutputThread(audioFlinger, output, id, OFFLOAD, systemReady), const audio_offload_info_t& offloadInfo) : DirectOutputThread(audioFlinger, output, id, OFFLOAD, systemReady, offloadInfo), mPausedWriteLength(0), mPausedBytesRemaining(0), mKeepWakeLock(true) mPausedWriteLength(0), mPausedBytesRemaining(0), mKeepWakeLock(true) { { //FIXME: mStandby should be set to true by ThreadBase constructo //FIXME: mStandby should be set to true by ThreadBase constructo Loading Loading @@ -7006,7 +7010,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr // No buffers for this track. Give it a few chances to // No buffers for this track. Give it a few chances to // fill a buffer, then remove it from active list. // fill a buffer, then remove it from active list. bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); if (--(track->mRetryCount) <= 0) { if (!isTunerStream() // tuner streams remain active in underrun && --(track->mRetryCount) <= 0) { if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. track->mRetryCount = kMaxTrackRetriesOffload; track->mRetryCount = kMaxTrackRetriesOffload; } else { } else { Loading services/audioflinger/Threads.h +9 −4 Original line number Original line Diff line number Diff line Loading @@ -1546,8 +1546,9 @@ class DirectOutputThread : public PlaybackThread { public: public: DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, bool systemReady) audio_io_handle_t id, bool systemReady, : DirectOutputThread(audioFlinger, output, id, DIRECT, systemReady) { } const audio_offload_info_t& offloadInfo) : DirectOutputThread(audioFlinger, output, id, DIRECT, systemReady, offloadInfo) { } virtual ~DirectOutputThread(); virtual ~DirectOutputThread(); Loading Loading @@ -1579,11 +1580,14 @@ protected: virtual void onAddNewTrack_l(); virtual void onAddNewTrack_l(); const audio_offload_info_t mOffloadInfo; bool mVolumeShaperActive = false; bool mVolumeShaperActive = false; DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, ThreadBase::type_t type, bool systemReady); audio_io_handle_t id, ThreadBase::type_t type, bool systemReady, const audio_offload_info_t& offloadInfo); void processVolume_l(Track *track, bool lastTrack); void processVolume_l(Track *track, bool lastTrack); bool isTunerStream() const { return (mOffloadInfo.content_id > 0); } // prepareTracks_l() tells threadLoop_mix() the name of the single active track // prepareTracks_l() tells threadLoop_mix() the name of the single active track sp<Track> mActiveTrack; sp<Track> mActiveTrack; Loading Loading @@ -1621,7 +1625,8 @@ class OffloadThread : public DirectOutputThread { public: public: OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, bool systemReady); audio_io_handle_t id, bool systemReady, const audio_offload_info_t& offloadInfo); virtual ~OffloadThread() {}; virtual ~OffloadThread() {}; void flushHw_l() override; void flushHw_l() override; Loading Loading
services/audioflinger/AudioFlinger.cpp +4 −2 Original line number Original line Diff line number Diff line Loading @@ -2869,13 +2869,15 @@ sp<AudioFlinger::ThreadBase> AudioFlinger::openOutput_l(audio_module_handle_t mo ALOGV("openOutput_l() created spatializer output: ID %d thread %p", ALOGV("openOutput_l() created spatializer output: ID %d thread %p", *output, thread.get()); *output, thread.get()); } else if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { } else if (flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) { thread = new OffloadThread(this, outputStream, *output, mSystemReady); thread = new OffloadThread(this, outputStream, *output, mSystemReady, halConfig->offload_info); ALOGV("openOutput_l() created offload output: ID %d thread %p", ALOGV("openOutput_l() created offload output: ID %d thread %p", *output, thread.get()); *output, thread.get()); } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) } else if ((flags & AUDIO_OUTPUT_FLAG_DIRECT) || !isValidPcmSinkFormat(halConfig->format) || !isValidPcmSinkFormat(halConfig->format) || !isValidPcmSinkChannelMask(halConfig->channel_mask)) { || !isValidPcmSinkChannelMask(halConfig->channel_mask)) { thread = new DirectOutputThread(this, outputStream, *output, mSystemReady); thread = new DirectOutputThread(this, outputStream, *output, mSystemReady, halConfig->offload_info); ALOGV("openOutput_l() created direct output: ID %d thread %p", ALOGV("openOutput_l() created direct output: ID %d thread %p", *output, thread.get()); *output, thread.get()); } else { } else { Loading
services/audioflinger/Threads.cpp +10 −5 Original line number Original line Diff line number Diff line Loading @@ -6143,8 +6143,10 @@ void AudioFlinger::MixerThread::cacheParameters_l() // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioFlinger::DirectOutputThread::DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, ThreadBase::type_t type, bool systemReady) AudioStreamOut* output, audio_io_handle_t id, ThreadBase::type_t type, bool systemReady, const audio_offload_info_t& offloadInfo) : PlaybackThread(audioFlinger, output, id, type, systemReady) : PlaybackThread(audioFlinger, output, id, type, systemReady) , mOffloadInfo(offloadInfo) { { setMasterBalance(audioFlinger->getMasterBalance_l()); setMasterBalance(audioFlinger->getMasterBalance_l()); } } Loading Loading @@ -6423,7 +6425,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep // fill a buffer, then remove it from active list. // fill a buffer, then remove it from active list. // Only consider last track started for mixer state control // Only consider last track started for mixer state control bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); if (--(track->mRetryCount) <= 0) { if (!isTunerStream() // tuner streams remain active in underrun && --(track->mRetryCount) <= 0) { if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. track->mRetryCount = kMaxTrackRetriesOffload; track->mRetryCount = kMaxTrackRetriesOffload; } else { } else { Loading Loading @@ -6786,8 +6789,9 @@ void AudioFlinger::AsyncCallbackThread::setAsyncError() // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- AudioFlinger::OffloadThread::OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioFlinger::OffloadThread::OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, bool systemReady) AudioStreamOut* output, audio_io_handle_t id, bool systemReady, : DirectOutputThread(audioFlinger, output, id, OFFLOAD, systemReady), const audio_offload_info_t& offloadInfo) : DirectOutputThread(audioFlinger, output, id, OFFLOAD, systemReady, offloadInfo), mPausedWriteLength(0), mPausedBytesRemaining(0), mKeepWakeLock(true) mPausedWriteLength(0), mPausedBytesRemaining(0), mKeepWakeLock(true) { { //FIXME: mStandby should be set to true by ThreadBase constructo //FIXME: mStandby should be set to true by ThreadBase constructo Loading Loading @@ -7006,7 +7010,8 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr // No buffers for this track. Give it a few chances to // No buffers for this track. Give it a few chances to // fill a buffer, then remove it from active list. // fill a buffer, then remove it from active list. bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); bool isTimestampAdvancing = mIsTimestampAdvancing.check(mOutput); if (--(track->mRetryCount) <= 0) { if (!isTunerStream() // tuner streams remain active in underrun && --(track->mRetryCount) <= 0) { if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. if (isTimestampAdvancing) { // HAL is still playing audio, give us more time. track->mRetryCount = kMaxTrackRetriesOffload; track->mRetryCount = kMaxTrackRetriesOffload; } else { } else { Loading
services/audioflinger/Threads.h +9 −4 Original line number Original line Diff line number Diff line Loading @@ -1546,8 +1546,9 @@ class DirectOutputThread : public PlaybackThread { public: public: DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, bool systemReady) audio_io_handle_t id, bool systemReady, : DirectOutputThread(audioFlinger, output, id, DIRECT, systemReady) { } const audio_offload_info_t& offloadInfo) : DirectOutputThread(audioFlinger, output, id, DIRECT, systemReady, offloadInfo) { } virtual ~DirectOutputThread(); virtual ~DirectOutputThread(); Loading Loading @@ -1579,11 +1580,14 @@ protected: virtual void onAddNewTrack_l(); virtual void onAddNewTrack_l(); const audio_offload_info_t mOffloadInfo; bool mVolumeShaperActive = false; bool mVolumeShaperActive = false; DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, DirectOutputThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, ThreadBase::type_t type, bool systemReady); audio_io_handle_t id, ThreadBase::type_t type, bool systemReady, const audio_offload_info_t& offloadInfo); void processVolume_l(Track *track, bool lastTrack); void processVolume_l(Track *track, bool lastTrack); bool isTunerStream() const { return (mOffloadInfo.content_id > 0); } // prepareTracks_l() tells threadLoop_mix() the name of the single active track // prepareTracks_l() tells threadLoop_mix() the name of the single active track sp<Track> mActiveTrack; sp<Track> mActiveTrack; Loading Loading @@ -1621,7 +1625,8 @@ class OffloadThread : public DirectOutputThread { public: public: OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, OffloadThread(const sp<AudioFlinger>& audioFlinger, AudioStreamOut* output, audio_io_handle_t id, bool systemReady); audio_io_handle_t id, bool systemReady, const audio_offload_info_t& offloadInfo); virtual ~OffloadThread() {}; virtual ~OffloadThread() {}; void flushHw_l() override; void flushHw_l() override; Loading