mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
Merge "audio: Fix the type used for timekeeping" into main
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user