Loading media/libaudioclient/AudioTrack.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -2401,12 +2401,14 @@ nsecs_t AudioTrack::processAudioBuffer() int32_t flags = android_atomic_and( ~(CBLK_UNDERRUN | CBLK_LOOP_CYCLE | CBLK_LOOP_FINAL | CBLK_BUFFER_END), &mCblk->mFlags); const bool isOffloaded = isOffloaded_l(); const bool isOffloadedOrDirect = isOffloadedOrDirect_l(); // Check for track invalidation if (flags & CBLK_INVALID) { // for offloaded tracks restoreTrack_l() will just update the sequence and clear // AudioSystem cache. We should not exit here but after calling the callback so // that the upper layers can recreate the track if (!isOffloadedOrDirect_l() || (mSequence == mObservedSequence)) { if (!isOffloadedOrDirect || (mSequence == mObservedSequence)) { status_t status __unused = restoreTrack_l("processAudioBuffer"); // FIXME unused status // after restoration, continue below to make sure that the loop and buffer events Loading Loading @@ -2576,7 +2578,7 @@ nsecs_t AudioTrack::processAudioBuffer() mObservedSequence = sequence; callback->onNewIAudioTrack(); // for offloaded tracks, just wait for the upper layers to recreate the track if (isOffloadedOrDirect()) { if (isOffloadedOrDirect) { return NS_INACTIVE; } } Loading Loading @@ -2664,7 +2666,7 @@ nsecs_t AudioTrack::processAudioBuffer() __func__, mPortId, mRemainingFrames, avail, audioBuffer.frameCount, nonContig, err); if (err != NO_ERROR) { if (err == TIMED_OUT || err == WOULD_BLOCK || err == -EINTR || (isOffloaded() && (err == DEAD_OBJECT))) { (isOffloaded && (err == DEAD_OBJECT))) { // FIXME bug 25195759 return 1000000; } Loading Loading @@ -2750,7 +2752,7 @@ nsecs_t AudioTrack::processAudioBuffer() // buffer size and skip the loop entirely. nsecs_t myns; if (audio_has_proportional_frames(mFormat)) { if (!isOffloaded && audio_has_proportional_frames(mFormat)) { // time to wait based on buffer occupancy const nsecs_t datans = mRemainingFrames <= avail ? 0 : framesToNanoseconds(mRemainingFrames - avail, sampleRate, speed); Loading services/audioflinger/Threads.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -7151,7 +7151,7 @@ bool DirectOutputThread::checkForNewParameter_l(const String8& keyValuePair, uint32_t DirectOutputThread::activeSleepTimeUs() const { uint32_t time; if (audio_has_proportional_frames(mFormat)) { if (audio_has_proportional_frames(mFormat) && mType != OFFLOAD) { time = PlaybackThread::activeSleepTimeUs(); } else { time = kDirectMinSleepTimeUs; Loading @@ -7162,7 +7162,7 @@ uint32_t DirectOutputThread::activeSleepTimeUs() const uint32_t DirectOutputThread::idleSleepTimeUs() const { uint32_t time; if (audio_has_proportional_frames(mFormat)) { if (audio_has_proportional_frames(mFormat) && mType != OFFLOAD) { time = (uint32_t)(((mFrameCount * 1000) / mSampleRate) * 1000) / 2; } else { time = kDirectMinSleepTimeUs; Loading @@ -7173,7 +7173,7 @@ uint32_t DirectOutputThread::idleSleepTimeUs() const uint32_t DirectOutputThread::suspendSleepTimeUs() const { uint32_t time; if (audio_has_proportional_frames(mFormat)) { if (audio_has_proportional_frames(mFormat) && mType != OFFLOAD) { time = (uint32_t)(((mFrameCount * 1000) / mSampleRate) * 1000); } else { time = kDirectMinSleepTimeUs; Loading @@ -7190,7 +7190,7 @@ void DirectOutputThread::cacheParameters_l() // no delay on outputs with HW A/V sync if (usesHwAvSync()) { mStandbyDelayNs = 0; } else if ((mType == OFFLOAD) && !audio_has_proportional_frames(mFormat)) { } else if (mType == OFFLOAD) { mStandbyDelayNs = kOffloadStandbyDelayNs; } else { mStandbyDelayNs = microseconds(mActiveSleepTimeUs*2); Loading Loading
media/libaudioclient/AudioTrack.cpp +6 −4 Original line number Diff line number Diff line Loading @@ -2401,12 +2401,14 @@ nsecs_t AudioTrack::processAudioBuffer() int32_t flags = android_atomic_and( ~(CBLK_UNDERRUN | CBLK_LOOP_CYCLE | CBLK_LOOP_FINAL | CBLK_BUFFER_END), &mCblk->mFlags); const bool isOffloaded = isOffloaded_l(); const bool isOffloadedOrDirect = isOffloadedOrDirect_l(); // Check for track invalidation if (flags & CBLK_INVALID) { // for offloaded tracks restoreTrack_l() will just update the sequence and clear // AudioSystem cache. We should not exit here but after calling the callback so // that the upper layers can recreate the track if (!isOffloadedOrDirect_l() || (mSequence == mObservedSequence)) { if (!isOffloadedOrDirect || (mSequence == mObservedSequence)) { status_t status __unused = restoreTrack_l("processAudioBuffer"); // FIXME unused status // after restoration, continue below to make sure that the loop and buffer events Loading Loading @@ -2576,7 +2578,7 @@ nsecs_t AudioTrack::processAudioBuffer() mObservedSequence = sequence; callback->onNewIAudioTrack(); // for offloaded tracks, just wait for the upper layers to recreate the track if (isOffloadedOrDirect()) { if (isOffloadedOrDirect) { return NS_INACTIVE; } } Loading Loading @@ -2664,7 +2666,7 @@ nsecs_t AudioTrack::processAudioBuffer() __func__, mPortId, mRemainingFrames, avail, audioBuffer.frameCount, nonContig, err); if (err != NO_ERROR) { if (err == TIMED_OUT || err == WOULD_BLOCK || err == -EINTR || (isOffloaded() && (err == DEAD_OBJECT))) { (isOffloaded && (err == DEAD_OBJECT))) { // FIXME bug 25195759 return 1000000; } Loading Loading @@ -2750,7 +2752,7 @@ nsecs_t AudioTrack::processAudioBuffer() // buffer size and skip the loop entirely. nsecs_t myns; if (audio_has_proportional_frames(mFormat)) { if (!isOffloaded && audio_has_proportional_frames(mFormat)) { // time to wait based on buffer occupancy const nsecs_t datans = mRemainingFrames <= avail ? 0 : framesToNanoseconds(mRemainingFrames - avail, sampleRate, speed); Loading
services/audioflinger/Threads.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -7151,7 +7151,7 @@ bool DirectOutputThread::checkForNewParameter_l(const String8& keyValuePair, uint32_t DirectOutputThread::activeSleepTimeUs() const { uint32_t time; if (audio_has_proportional_frames(mFormat)) { if (audio_has_proportional_frames(mFormat) && mType != OFFLOAD) { time = PlaybackThread::activeSleepTimeUs(); } else { time = kDirectMinSleepTimeUs; Loading @@ -7162,7 +7162,7 @@ uint32_t DirectOutputThread::activeSleepTimeUs() const uint32_t DirectOutputThread::idleSleepTimeUs() const { uint32_t time; if (audio_has_proportional_frames(mFormat)) { if (audio_has_proportional_frames(mFormat) && mType != OFFLOAD) { time = (uint32_t)(((mFrameCount * 1000) / mSampleRate) * 1000) / 2; } else { time = kDirectMinSleepTimeUs; Loading @@ -7173,7 +7173,7 @@ uint32_t DirectOutputThread::idleSleepTimeUs() const uint32_t DirectOutputThread::suspendSleepTimeUs() const { uint32_t time; if (audio_has_proportional_frames(mFormat)) { if (audio_has_proportional_frames(mFormat) && mType != OFFLOAD) { time = (uint32_t)(((mFrameCount * 1000) / mSampleRate) * 1000); } else { time = kDirectMinSleepTimeUs; Loading @@ -7190,7 +7190,7 @@ void DirectOutputThread::cacheParameters_l() // no delay on outputs with HW A/V sync if (usesHwAvSync()) { mStandbyDelayNs = 0; } else if ((mType == OFFLOAD) && !audio_has_proportional_frames(mFormat)) { } else if (mType == OFFLOAD) { mStandbyDelayNs = kOffloadStandbyDelayNs; } else { mStandbyDelayNs = microseconds(mActiveSleepTimeUs*2); Loading