From 5a1efdecfd356e845aa09616d02ff02c706792e2 Mon Sep 17 00:00:00 2001 From: Tiago Medicci Serrano Date: Mon, 1 May 2023 21:10:27 -0300 Subject: [PATCH] documentation: add references to RTP Tools' defconfigs Added examples of using the RTP Tools (`rtpdump`, in particular) to receive RTP packets and 1) print the data and/or 2) playback audio content through I2S. --- Documentation/guides/simulator.rst | 2 + .../platforms/sim/sim/boards/sim/index.rst | 34 +++++++++ .../xtensa/esp32/boards/esp32-lyrat/index.rst | 74 +++++++++++++++++++ 3 files changed, 110 insertions(+) diff --git a/Documentation/guides/simulator.rst b/Documentation/guides/simulator.rst index 3110acc9a6..17b3b5f9f1 100644 --- a/Documentation/guides/simulator.rst +++ b/Documentation/guides/simulator.rst @@ -91,6 +91,8 @@ Compiling $ $ # we're back at the Linux prompt. +.. _simulator_accessing_the_network: + Accessing the Network --------------------- diff --git a/Documentation/platforms/sim/sim/boards/sim/index.rst b/Documentation/platforms/sim/sim/boards/sim/index.rst index 48d25f6575..62f99d2e20 100644 --- a/Documentation/platforms/sim/sim/boards/sim/index.rst +++ b/Documentation/platforms/sim/sim/boards/sim/index.rst @@ -1247,6 +1247,40 @@ the returned packet. See also the 'pktradio' configuration. +rtptools +-------- + +**RTP Tools** is a set of small applications that can be used for processing RTP data. + +- ``rtpplay``: playback RTP sessions recorded by ``rtpdump`` +- ``rtpsend``: generate RTP packets from the textual description, generated by hand or ``rtpdump`` +- ``rtpdump``: parse and print RTP packets, generating output files suitable for ``rtpplay`` and ``rtpsend`` +- ``rtptrans``: RTP translator between unicast and multicast networks + +This configuration is based on the :ref:`sim:tcpblaster ` and +builds the ``rtpdump``. This application is able to receive RTP packets and print the contents. +As a real-world application, one could write the received content to a FIFO and play it with +``nxplayer``. + +To build it, follow the instructions for :ref:`Accessing the Network `. + +.. tip:: + One can use ``pulseaudio`` to send RTP packets through the network:: + + pactl load-module module-null-sink sink_name=rtp format=s16le channels=2 rate=44100 sink_properties="device.description='RTP'" + pactl load-module module-rtp-send source=rtp.monitor format=s16le destination_ip=10.0.1.2 port=46998 + + The loaded sink ``RTP`` is used to send PC's audio to the ``10.0.1.2:46998`` address (SIM's IP). + +After being able to access the network through the simulator, run:: + + nsh> rtpdump -F short /46998 & + rtpdump [5:100] + nsh> 42949704.930000 1277462397 15308 + 42949704.930000 1277462714 15309 + +For a real-world application, check :ref:`RTP Tools on ESP32-LyraT board `. + spiffs ------ diff --git a/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst b/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst index d2a738f1ea..4cbd1f9d29 100644 --- a/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst +++ b/Documentation/platforms/xtensa/esp32/boards/esp32-lyrat/index.rst @@ -499,6 +499,80 @@ To record audio, execute the following commands:: To play the recorded audio, import the raw data into Audacity and set the encoding to signed 16-bit PCM, the sample rate to 44.1kHz and the number of channels to 2. +.. _esp32-lyrat_rtptools: + +rtptools +-------- + +**RTP Tools** is a set of small applications that can be used for processing RTP data. + +- ``rtpplay``: play back RTP sessions recorded by ``rtpdump`` +- ``rtpsend``: generate RTP packets from the textual description, generated by hand or ``rtpdump`` +- ``rtpdump``: parse and print RTP packets, generating output files suitable for ``rtpplay`` and ``rtpsend`` +- ``rtptrans``: RTP translator between unicast and multicast networks + +This application is able to receive RTP packets and write the content to a FIFO. ``nxplayer`` then reads +from the FIFO, enabling using NuttX as a RTP receiver for audio applications. + +This is particularly useful to stream uncompressed audio through Wi-Fi to remote speakers. + +**Connect to your Network** + +Connect the ESP32-LyraT board to your network in order to be able to receive RTP packets:: + + nsh> wapi psk wlan0 mypasswd 3 + nsh> wapi essid wlan0 myssid 1 + nsh> renew wlan0 + nsh> ifconfig + wlan0 Link encap:Ethernet HWaddr aa:bb:cc:dd:ff:ee at RUNNING mtu 1504 + inet addr:192.168.1.38 DRaddr:192.168.1.1 Mask:255.255.255.0 + + IPv4 TCP UDP ICMP + Received 00d5 0000 00d4 0000 + Dropped 0001 0000 0000 0000 + IPv4 VHL: 0000 Frg: 0000 + Checksum 0000 0000 0000 ---- + TCP ACK: 0000 SYN: 0000 + RST: 0000 0000 + Type 0000 ---- ---- 0000 + Sent 0002 0000 0002 0000 + Rexmit ---- 0000 ---- ---- + +Please, check your device's IP (``192.168.1.38`` in this example): +RTP packets will be sent to it. + +**Sending Audio through pulseaudio** + +``pulseaudio`` is able to send RTP packets through the network:: + + pactl load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 sink_properties="device.description='RTP'" + pactl load-module module-rtp-send source=rtp.monitor format=s16le destination_ip=192.168.1.38 port=46998 + +The loaded sink is used to send PC audio through RTP, using the ``192.168.1.38:46998`` +(boards's IP in this example, please adjust accordingly). + +**Receiving the RTP packets** + +RTP packets will be written to a FIFO: create the FIFO and run ``rtpdump`` +on background:: + + nsh> mkfifo temp + nsh> rtpdump -F payload -o temp /46998 & + rtpdump [31:100] + +**Playing Audio** + +Finally, run ``nxplayer`` to play from the FIFO:: + + nsh> nxplayer + NxPlayer version 1.05 + h for commands, q to exit + + nxplayer> playraw temp 2 16 44100 + +This board contains the ES8388 audio codec. Please attach your headphones to listen to the +content streamed through the Wi-Fi in CD quality! + wifi ----