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

Commit ed74d9c5 authored by Andy Hung's avatar Andy Hung Committed by Android Git Automerger
Browse files

am 0c4249ae: am 2c7d0f20: Merge "Fix restore position warning and static track...

am 0c4249ae: am 2c7d0f20: Merge "Fix restore position warning and static track adjustment" into mnc-dev

* commit '0c4249ae':
  Fix restore position warning and static track adjustment
parents 9269f167 0c4249ae
Loading
Loading
Loading
Loading
+9 −9
Original line number Original line Diff line number Diff line
@@ -483,7 +483,6 @@ status_t AudioTrack::set(
    mMarkerReached = false;
    mMarkerReached = false;
    mNewPosition = 0;
    mNewPosition = 0;
    mUpdatePeriod = 0;
    mUpdatePeriod = 0;
    mServer = 0;
    mPosition = 0;
    mPosition = 0;
    mReleased = 0;
    mReleased = 0;
    mStartUs = 0;
    mStartUs = 0;
@@ -1389,6 +1388,9 @@ status_t AudioTrack::createTrack_l()
        mReqFrameCount = frameCount;
        mReqFrameCount = frameCount;
    }
    }


    // reset server position to 0 as we have new cblk.
    mServer = 0;

    // update proxy
    // update proxy
    if (mSharedBuffer == 0) {
    if (mSharedBuffer == 0) {
        mStaticProxy.clear();
        mStaticProxy.clear();
@@ -2109,15 +2111,13 @@ status_t AudioTrack::restoreTrack_l(const char *from)
    // If a new IAudioTrack cannot be created, the previous (dead) instance will be left intact.
    // If a new IAudioTrack cannot be created, the previous (dead) instance will be left intact.
    status_t result = createTrack_l();
    status_t result = createTrack_l();


    if (result == NO_ERROR) {
        // take the frames that will be lost by track recreation into account in saved position
        // take the frames that will be lost by track recreation into account in saved position
        // For streaming tracks, this is the amount we obtained from the user/client
        // For streaming tracks, this is the amount we obtained from the user/client
        // (not the number actually consumed at the server - those are already lost).
        // (not the number actually consumed at the server - those are already lost).
    (void) updateAndGetPosition_l();
        if (mStaticProxy == 0) {
        if (mStaticProxy == 0) {
            mPosition = mReleased;
            mPosition = mReleased;
        }
        }

    if (result == NO_ERROR) {
        // Continue playback from last known position and restore loop.
        // Continue playback from last known position and restore loop.
        if (mStaticProxy != 0) {
        if (mStaticProxy != 0) {
            if (loopCount != 0) {
            if (loopCount != 0) {