Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3136b33e authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioTrack: fix obtainBuffer timeout calculation"

parents 9be49c91 df576995
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -570,13 +570,13 @@ status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
    }
    }


    const struct timespec *requested;
    const struct timespec *requested;
    struct timespec timeout;
    if (waitCount == -1) {
    if (waitCount == -1) {
        requested = &ClientProxy::kForever;
        requested = &ClientProxy::kForever;
    } else if (waitCount == 0) {
    } else if (waitCount == 0) {
        requested = &ClientProxy::kNonBlocking;
        requested = &ClientProxy::kNonBlocking;
    } else if (waitCount > 0) {
    } else if (waitCount > 0) {
        long long ms = WAIT_PERIOD_MS * (long long) waitCount;
        long long ms = WAIT_PERIOD_MS * (long long) waitCount;
        struct timespec timeout;
        timeout.tv_sec = ms / 1000;
        timeout.tv_sec = ms / 1000;
        timeout.tv_nsec = (int) (ms % 1000) * 1000000;
        timeout.tv_nsec = (int) (ms % 1000) * 1000000;
        requested = &timeout;
        requested = &timeout;
+1 −1
Original line number Original line Diff line number Diff line
@@ -1133,13 +1133,13 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
    }
    }


    const struct timespec *requested;
    const struct timespec *requested;
    struct timespec timeout;
    if (waitCount == -1) {
    if (waitCount == -1) {
        requested = &ClientProxy::kForever;
        requested = &ClientProxy::kForever;
    } else if (waitCount == 0) {
    } else if (waitCount == 0) {
        requested = &ClientProxy::kNonBlocking;
        requested = &ClientProxy::kNonBlocking;
    } else if (waitCount > 0) {
    } else if (waitCount > 0) {
        long long ms = WAIT_PERIOD_MS * (long long) waitCount;
        long long ms = WAIT_PERIOD_MS * (long long) waitCount;
        struct timespec timeout;
        timeout.tv_sec = ms / 1000;
        timeout.tv_sec = ms / 1000;
        timeout.tv_nsec = (int) (ms % 1000) * 1000000;
        timeout.tv_nsec = (int) (ms % 1000) * 1000000;
        requested = &timeout;
        requested = &timeout;