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

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

Don't create empty .wav files

Bug: 78287983
Test: follow the tee sink documentation, and then verify there are no empty files
Change-Id: I0aa98aff5d0d47b86f36dd38a54d0daf3feb1965
parent c4b259a5
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -3446,9 +3446,14 @@ void AudioFlinger::dumpTee(int fd, const sp<NBAIO_Source>& source, audio_io_hand
            // FIXME not big-endian safe
            write(teeFd, &temp, sizeof(temp));
            close(teeFd);
            // TODO Should create file with temporary name and then rename to final if non-empty.
            if (total > 0) {
                if (fd >= 0) {
                    dprintf(fd, "tee copied to %s\n", teePath);
                }
            } else {
                unlink(teePath);
            }
        } else {
            if (fd >= 0) {
                dprintf(fd, "unable to create tee %s: %s\n", teePath, strerror(errno));