Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58721a10 authored by Zhou Song's avatar Zhou Song Committed by Automerger Merge Worker
Browse files

audio: return accurate frame count when track is flushed am: 8735d0dd am: f0a36003

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/1644226

Change-Id: Ie3b2a0e041d8b3b93cd46e02e204dbc3ce9f113f
parents 89869f0a f0a36003
Loading
Loading
Loading
Loading
+2 −5
Original line number Original line Diff line number Diff line
@@ -900,11 +900,8 @@ size_t AudioTrackServerProxy::framesReady()
    }
    }
    audio_track_cblk_t* cblk = mCblk;
    audio_track_cblk_t* cblk = mCblk;


    int32_t flush = cblk->u.mStreaming.mFlush;
    flushBufferIfNeeded();
    if (flush != mFlush) {

        // FIXME should return an accurate value, but over-estimate is better than under-estimate
        return mFrameCount;
    }
    const int32_t rear = getRear();
    const int32_t rear = getRear();
    ssize_t filled = audio_utils::safe_sub_overflow(rear, cblk->u.mStreaming.mFront);
    ssize_t filled = audio_utils::safe_sub_overflow(rear, cblk->u.mStreaming.mFront);
    // pipe should not already be overfull
    // pipe should not already be overfull
+5 −0
Original line number Original line Diff line number Diff line
@@ -1038,6 +1038,11 @@ status_t AudioFlinger::PlaybackThread::Track::start(AudioSystem::sync_event_t ev
        // initial state-stopping. next state-pausing.
        // initial state-stopping. next state-pausing.
        // What if resume is called ?
        // What if resume is called ?


        if (state == FLUSHED) {
            // avoid underrun glitches when starting after flush
            reset();
        }

        if (state == PAUSED || state == PAUSING) {
        if (state == PAUSED || state == PAUSING) {
            if (mResumeToStopping) {
            if (mResumeToStopping) {
                // happened we need to resume to STOPPING_1
                // happened we need to resume to STOPPING_1