Loading media/libaaudio/src/client/AudioStreamInternalPlay.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -117,7 +117,8 @@ void AudioStreamInternalPlay::prepareBuffersForStop() { return; } // Sleep until the DSP has read all of the data written. int64_t validFramesInBuffer = getFramesWritten() - getFramesRead(); int64_t validFramesInBuffer = mAudioEndpoint->getDataWriteCounter() - mAudioEndpoint->getDataReadCounter(); if (validFramesInBuffer >= 0) { int64_t emptyFramesInBuffer = ((int64_t) getBufferCapacity()) - validFramesInBuffer; Loading @@ -131,7 +132,8 @@ void AudioStreamInternalPlay::prepareBuffersForStop() { // Sleep until we are confident the DSP has consumed all of the valid data. // Sleep for one extra burst as a safety margin because the IsochronousClockModel // is not perfectly accurate. int64_t positionInEmptyMemory = getFramesWritten() + getFramesPerBurst(); // The ClockModel uses the server frame position so do not use getFramesWritten(). int64_t positionInEmptyMemory = mAudioEndpoint->getDataWriteCounter() + getFramesPerBurst(); int64_t timeAllConsumed = mClockModel.convertPositionToTime(positionInEmptyMemory); int64_t durationAllConsumed = timeAllConsumed - AudioClock::getNanoseconds(); // Prevent sleeping for too long. Loading media/libaaudio/src/client/IsochronousClockModel.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -269,9 +269,8 @@ int64_t IsochronousClockModel::convertPositionToTime(int64_t framePosition) cons int64_t framesDelta = nextBurstPosition - mMarkerFramePosition; int64_t nanosDelta = convertDeltaPositionToTime(framesDelta); int64_t time = mMarkerNanoTime + nanosDelta; // ALOGD("convertPositionToTime: pos = %llu --> time = %llu", // (unsigned long long)framePosition, // (unsigned long long)time); // ALOGD("%s(): pos = %" PRId64 " --> time = %" PRId64, __func__, // framePosition, time); return time; } Loading Loading
media/libaaudio/src/client/AudioStreamInternalPlay.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -117,7 +117,8 @@ void AudioStreamInternalPlay::prepareBuffersForStop() { return; } // Sleep until the DSP has read all of the data written. int64_t validFramesInBuffer = getFramesWritten() - getFramesRead(); int64_t validFramesInBuffer = mAudioEndpoint->getDataWriteCounter() - mAudioEndpoint->getDataReadCounter(); if (validFramesInBuffer >= 0) { int64_t emptyFramesInBuffer = ((int64_t) getBufferCapacity()) - validFramesInBuffer; Loading @@ -131,7 +132,8 @@ void AudioStreamInternalPlay::prepareBuffersForStop() { // Sleep until we are confident the DSP has consumed all of the valid data. // Sleep for one extra burst as a safety margin because the IsochronousClockModel // is not perfectly accurate. int64_t positionInEmptyMemory = getFramesWritten() + getFramesPerBurst(); // The ClockModel uses the server frame position so do not use getFramesWritten(). int64_t positionInEmptyMemory = mAudioEndpoint->getDataWriteCounter() + getFramesPerBurst(); int64_t timeAllConsumed = mClockModel.convertPositionToTime(positionInEmptyMemory); int64_t durationAllConsumed = timeAllConsumed - AudioClock::getNanoseconds(); // Prevent sleeping for too long. Loading
media/libaaudio/src/client/IsochronousClockModel.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -269,9 +269,8 @@ int64_t IsochronousClockModel::convertPositionToTime(int64_t framePosition) cons int64_t framesDelta = nextBurstPosition - mMarkerFramePosition; int64_t nanosDelta = convertDeltaPositionToTime(framesDelta); int64_t time = mMarkerNanoTime + nanosDelta; // ALOGD("convertPositionToTime: pos = %llu --> time = %llu", // (unsigned long long)framePosition, // (unsigned long long)time); // ALOGD("%s(): pos = %" PRId64 " --> time = %" PRId64, __func__, // framePosition, time); return time; } Loading