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

Commit 9b53db37 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

AudioTrack write() on a full buffer while paused returns 0

Change-Id: I85d44452cd8a5f87c7fc9b6a0858569cb5293eb4
parent f7e0a370
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -520,6 +520,10 @@ jint writeToTrack(const sp<AudioTrack>& track, jint audioFormat, jbyte* data,
    // regular write() or copy the data to the AudioTrack's shared memory?
    if (track->sharedBuffer() == 0) {
        written = track->write(data + offsetInBytes, sizeInBytes);
        // for compatibility with earlier behavior of write(), return 0 in this case
        if (written == (ssize_t) WOULD_BLOCK) {
            written = 0;
        }
    } else {
        if (audioFormat == javaAudioTrackFields.PCM16) {
            // writing to shared memory, check for capacity