AudioTrack, AudioRecord: Fix latency computation

Force 64 bit arithmetic to avoid integer overflow on 32 bit
platforms.

Test: CTS AudioTrackTest
Bug: 65536481
Change-Id: I774a7811fce08c7cbe59f0a062fd2c2d72220203
gugelfrei
Andy Hung 7 years ago
parent 49997ac32b
commit 13969262f7

@ -274,7 +274,7 @@ status_t AudioRecord::set(
mStatus = NO_ERROR;
mUserData = user;
// TODO: add audio hardware input latency here
mLatency = (1000 * mFrameCount) / mSampleRate;
mLatency = (1000LL * mFrameCount) / mSampleRate;
mMarkerPosition = 0;
mMarkerReached = false;
mNewPosition = 0;

@ -1279,7 +1279,7 @@ void AudioTrack::updateLatency_l()
ALOGW("getLatency(%d) failed status %d", mOutput, status);
} else {
// FIXME don't believe this lie
mLatency = mAfLatency + (1000 * mFrameCount) / mSampleRate;
mLatency = mAfLatency + (1000LL * mFrameCount) / mSampleRate;
}
}

Loading…
Cancel
Save