Merge "audio: Fix the type used for timekeeping" into main am: e3ed739865
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2894924 Change-Id: I9132e20ebf7a8de5ec3d574552705f41d0aeefa2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
da3b33a4f4
3 changed files with 5 additions and 5 deletions
|
@ -36,7 +36,7 @@ class StreamPrimary : public StreamAlsa {
|
|||
std::vector<alsa::DeviceProfile> getDeviceProfiles() override;
|
||||
|
||||
const bool mIsAsynchronous;
|
||||
long mStartTimeNs = 0;
|
||||
int64_t mStartTimeNs = 0;
|
||||
long mFramesSinceStart = 0;
|
||||
bool mSkipNextTransfer = false;
|
||||
};
|
||||
|
|
|
@ -64,7 +64,7 @@ class StreamRemoteSubmix : public StreamCommonImpl {
|
|||
// 5ms between two read attempts when pipe is empty
|
||||
static constexpr int kReadAttemptSleepUs = 5000;
|
||||
|
||||
long mStartTimeNs = 0;
|
||||
int64_t mStartTimeNs = 0;
|
||||
long mFramesSinceStart = 0;
|
||||
int mReadErrorCount = 0;
|
||||
};
|
||||
|
|
|
@ -138,7 +138,7 @@ void StreamRemoteSubmix::shutdown() {
|
|||
: outWrite(buffer, frameCount, actualFrameCount));
|
||||
const long bufferDurationUs =
|
||||
(*actualFrameCount) * MICROS_PER_SECOND / mContext.getSampleRate();
|
||||
const long totalDurationUs = (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND;
|
||||
const auto totalDurationUs = (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND;
|
||||
mFramesSinceStart += *actualFrameCount;
|
||||
const long totalOffsetUs =
|
||||
mFramesSinceStart * MICROS_PER_SECOND / mContext.getSampleRate() - totalDurationUs;
|
||||
|
@ -274,8 +274,8 @@ size_t StreamRemoteSubmix::getStreamPipeSizeInFrames() {
|
|||
char* buff = (char*)buffer;
|
||||
size_t actuallyRead = 0;
|
||||
long remainingFrames = frameCount;
|
||||
const long deadlineTimeNs = ::android::uptimeNanos() +
|
||||
getDelayInUsForFrameCount(frameCount) * NANOS_PER_MICROSECOND;
|
||||
const int64_t deadlineTimeNs = ::android::uptimeNanos() +
|
||||
getDelayInUsForFrameCount(frameCount) * NANOS_PER_MICROSECOND;
|
||||
while (remainingFrames > 0) {
|
||||
ssize_t framesRead = source->read(buff, remainingFrames);
|
||||
LOG(VERBOSE) << __func__ << ": frames read " << framesRead;
|
||||
|
|
Loading…
Reference in a new issue