[roll] Roll fuchsia [media][tools] Fix "wav_recorder --duration"

Previously, when the '--duration' flag was used with wav_recorder,
it always finished early. Now, when provided a specific duration
to record, we pre-calculate the number of frames and stop once we
reach/exceed that amount (trimming the amount back if we exceed),
so that we record the precise number of frames requested.

In addition to the bug referenced below, this was requested by
FCT folks.

The following .wav file sizes demonstrate our new precision
(keeping in mind that the RIFF WAV header itself is 44 bytes).

-- Very short:

$ wav_recorder --duration=.001 --chans=1 --int16 --rate=1000 \
               /tmp/tiny.wav

We will record for 0.001 seconds.
Recording 16-bit signed int, 1000 Hz, 1-channel linear PCM
from default input into '/tmp/tiny.wav' for 1 frames (1.000000 msec)
using the default reference clock
using 10 packets of 100 frames (100.000 msec) in a 1.000-sec payload buffer

Shutting down...
We recorded 1 frames.
$ ls -l /tmp/tiny.wav
-rw-------    1 0        0                46 May 04 04:24 /tmp/tiny.wav

-- And very long (with precise frame rate for a nice round size):

$ wav_recorder --loopback --duration=10 --chans=4 \
               --sync --rate=187500 /tmp/big_ten.wav

We will record for 10.000 seconds.
Recording 32-bit float, 187500 Hz, 4-channel linear PCM
from loopback into '/tmp/big_ten.wav' for 1875000 frames (10000.000000 msec)
using the default reference clock
using 10 packets of 18750 frames (100.000 msec) in a 1.000-sec payload buffer

Shutting down...
We recorded 1875000 frames.
$ ls -l /tmp/big_ten.wav
-rw-------    1 0        0          30000044 May 04 04:31 /tmp/big_ten.wav

Original-Fixed: b/148807692

Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/524227
Original-Revision: e438ae1f5308b7510f2d0a7131e5a60a1f212ef9
GitOrigin-RevId: 547ffdf2120284a2905bf2f753ab6931d5a7aee1
Change-Id: Ifa1c48f0cb6c0e6601def8a8103107ba8266c04b
1 file changed
tree: f1a0ef6557e6c2c764887efc116111b19cc9ce65
  1. garnet/
  2. infra/
  3. peridot/
  4. third_party/
  5. topaz/
  6. zircon/
  7. firmware
  8. flower
  9. jiri.lock
  10. minimal
  11. prebuilts
  12. README.md
  13. stem
  14. test_durations
README.md

Integration

This repository contains Fuchsia's Global Integration manifest files.

Making changes

All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.

Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.

Obtaining the source

First install Jiri.

Next run:

$ jiri init
$ jiri import minimal https://fuchsia.googlesource.com/integration
$ jiri update

Third party

Third party projects should have their own subdirectory in ./third_party.