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

Commit 5362a14b authored by Dorin Drimus's avatar Dorin Drimus
Browse files

Allow non pcm formats for setBufferSizeInFrames

For compressed formats the buffer size is actual bytes (or a frame is
considered equal to 1 byte).

Test: atest AudioTrackLatencyTest#testSetBufferSize
Test: manual test to set buffer size for an EAC3 AudioTrack
Bug: 192343963
Change-Id: Id9ba3da8e431208f38639004a47a4a27235e9d71
parent 45670b1c
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1275,10 +1275,6 @@ ssize_t AudioTrack::setBufferSizeInFrames(size_t bufferSizeInFrames)
    if (mOutput == AUDIO_IO_HANDLE_NONE || mProxy.get() == 0) {
        return NO_INIT;
    }
    // Reject if timed track or compressed audio.
    if (!audio_is_linear_pcm(mFormat)) {
        return INVALID_OPERATION;
    }

    ssize_t originalBufferSize = mProxy->getBufferSizeInFrames();
    ssize_t finalBufferSize  = mProxy->setBufferSizeInFrames((uint32_t) bufferSizeInFrames);
+1 −2
Original line number Diff line number Diff line
@@ -427,8 +427,7 @@ public:
     * less than or equal to the getBufferCapacityInFrames().
     * It may also be adjusted slightly for internal reasons.
     *
     * Return the final size or a negative error if the track is unitialized
     * or does not support variable sizes.
     * Return the final size or a negative value (NO_INIT) if the track is uninitialized.
     */
            ssize_t     setBufferSizeInFrames(size_t size);