424635328 opened a new pull request, #3995:
URL: https://github.com/apache/nuttx-apps/pull/3995

   ## Summary
   
   Six commits for the audio command line applications:
   
   - nxplayer, nxrecorder and nxlooper take their command line from the
     temporary buffer pool instead of the stack of `main()`. Each instance used
     to reserve `LINE_MAX` bytes for its whole lifetime.
   - `nxplayer_parse_mp3()` checks the seek and the four byte read that skip the
     ID3v2 tag. A failed seek is reported, and a short read is treated as end of
     data instead of parsing a buffer that was never filled.
   - nxplayer checks the result of `mq_close()`, drops an assertion whose lower
     bound can never fail, and reports and destroys the play thread attributes.
   - libmad passes `-Wno-stringop-overflow` only to GCC. clang does not know the
     option and rejects it when warnings are errors.
   - The mediadir command gets braces around its two bodies, which nxstyle
     requires now that the file is checked as a whole.
   
   ## Impact
   
   - The PCM data path is unchanged: playback, recording and loopback deliver 
the
     same bytes as before.
   - The stack of each command line application drops by `LINE_MAX` bytes.
   - The mp3 change only alters behaviour when the seek fails or the tag is
     truncated; both were silently ignored before.
   
   ## Testing
   
   Built for the simulator (sim, GCC). A fake audio lower half provides a
   playback device (`pcm0p`) and a capture device (`pcm0c`): it writes the
   buffers it receives to a file and reads capture buffers from a file, so both
   directions can be compared byte for byte. The fake driver is test scaffolding
   and is not part of this PR.
   
   Playback, 2 s of a 440 Hz sine, 16 kHz mono 16 bit:
   
   ```
   nsh> mount -t hostfs -o fs=<host-dir> /host
   nsh> nxplayer
   nxplayer> device pcm0p
   nxplayer> playraw /host/tone.raw 1 16 16000
   ```
   
   64000 bytes reached the device, identical to the input (md5 `872472d8...`).
   
   Recording and loopback, the capture device replays a 1 s pattern:
   
   ```
   nxrecorder> device pcm0c
   nxrecorder> recordraw /host/rec.raw 1 16 16000
   
   nxlooper> device pcm0p
   nxlooper> device pcm0c
   nxlooper> loopback 1 16 16000 0 0
   ```
   
   In both cases the first 32000 bytes are identical to the capture source
   (md5 `ff66fe80...`).
   
   `nxplayer_parse_mp3()` has no runnable path on the simulator, because 
nxplayer
   only selects a device that advertises MPEG support. It was tested on the host
   with the same source file:
   
   | case | before | after |
   |-|-|-|
   | ID3v2 tag, then a valid frame | 0, 44100 Hz stereo | 0, 44100 Hz stereo |
   | tag truncated by two bytes | 0, parses an unfilled buffer | `-ENODATA` |
   | descriptor that cannot seek | 0, seek failure ignored | `-ESPIPE` |
   
   Build and style:
   
   | item | result |
   |-|-|
   | `make -j16`, sim | builds; no warning from the changed files |
   | `checkpatch.sh -c -u -m -g` | `All checks pass` |
   | CMake, GCC | libmad compiled with `-Wno-stringop-overflow` |
   | CMake, clang | option not passed, libmad still compiles |
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to