mReleased represents the number of frames written to the
track, but was cleared on start() causing a mismatch if the
client wrote to the track before starting. Moved the clearing
to entering the STATE_STOPPED or STATE_FLUSHED state.
Bug:
18017947
Bug:
18022276
Change-Id: I3788c98c4c3c4d9cc004378432797b3f3138e22e
if (previousState == STATE_STOPPED || previousState == STATE_FLUSHED) {
// reset current position as seen by client to 0
mPosition = 0;
- mReleased = 0;
// For offloaded tracks, we don't know if the hardware counters are really zero here,
// since the flush is asynchronous and stop may not fully drain.
// We save the time when the track is started to later verify whether
mState = STATE_STOPPING;
} else {
mState = STATE_STOPPED;
+ mReleased = 0;
}
mProxy->interrupt();
mRefreshRemaining = true;
mState = STATE_FLUSHED;
+ mReleased = 0;
if (isOffloaded_l()) {
mProxy->interrupt();
}
waitStreamEnd = mState == STATE_STOPPING;
if (waitStreamEnd) {
mState = STATE_STOPPED;
+ mReleased = 0;
}
}
if (waitStreamEnd && status != DEAD_OBJECT) {
if (result != NO_ERROR) {
ALOGW("restoreTrack_l() failed status %d", result);
mState = STATE_STOPPED;
+ mReleased = 0;
}
return result;