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

Commit a4f24ff9 authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioTrack: fix position callback after restore

When restoring an AudioTrack, the next position callback point
should not be modified and set ahead of current buffer head.
Otherwise, as frames are dropped, the new position is never reached
and an application relying on position callbacks to reload the buffer
would be stalled.

Bug: 11868603.
Change-Id: I93b2a311642a0c89944b78bcc0482d4ceed98ae4
parent 5ea5b020
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1675,7 +1675,6 @@ status_t AudioTrack::restoreTrack_l(const char *from)

    // take the frames that will be lost by track recreation into account in saved position
    size_t position = mProxy->getPosition() + mProxy->getFramesFilled();
    mNewPosition = position + mUpdatePeriod;
    size_t bufferPosition = mStaticProxy != NULL ? mStaticProxy->getBufferPosition() : 0;
    result = createTrack_l(mStreamType,
                           mSampleRate,