Prevent TunerHAL passthrough from going into standby
Test: compiles, see bug
Bug: 226349461
Change-Id: Ic5175bc79cf699cbacf9799940bdf5abfd87a3a3
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index d1d359c..be2bdb7 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -6143,8 +6143,10 @@
// ----------------------------------------------------------------------------
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)
+ , mOffloadInfo(offloadInfo)
{
setMasterBalance(audioFlinger->getMasterBalance_l());
}
@@ -6423,7 +6425,8 @@
// fill a buffer, then remove it from active list.
// Only consider last track started for mixer state control
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.
track->mRetryCount = kMaxTrackRetriesOffload;
} else {
@@ -6786,8 +6789,9 @@
// ----------------------------------------------------------------------------
AudioFlinger::OffloadThread::OffloadThread(const sp<AudioFlinger>& audioFlinger,
- AudioStreamOut* output, audio_io_handle_t id, bool systemReady)
- : DirectOutputThread(audioFlinger, output, id, OFFLOAD, systemReady),
+ AudioStreamOut* output, audio_io_handle_t id, bool systemReady,
+ const audio_offload_info_t& offloadInfo)
+ : DirectOutputThread(audioFlinger, output, id, OFFLOAD, systemReady, offloadInfo),
mPausedWriteLength(0), mPausedBytesRemaining(0), mKeepWakeLock(true)
{
//FIXME: mStandby should be set to true by ThreadBase constructo
@@ -7006,7 +7010,8 @@
// No buffers for this track. Give it a few chances to
// fill a buffer, then remove it from active list.
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.
track->mRetryCount = kMaxTrackRetriesOffload;
} else {