Avnu / libavtp

Open source implementation of Audio Video Transport Protocol (AVTP) specified in IEEE 1722-2016 spec.
BSD 3-Clause "New" or "Revised" License
62 stars 34 forks source link

Failed to send AAF PDU #36

Closed Deepa-Santhosh closed 2 years ago

Deepa-Santhosh commented 2 years ago

Hi, I am trying to run AVB Audio Talker/Listener Examples. I have configured all the system setup required for the experiment.

While running the command, sudo speaker-test -p 25000 -F S16_BE -c 2 -r 48000 -D aaf0 on the talker host, I am getting the below mentioned error :

speaker-test 1.1.9

Playback device is aaf0 Stream parameters are 48000Hz, S16_BE, 2 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 1 to 206158430 Period size range from 0 to 206158431 Requested period time 25000 us Periods = 4 was set period_size = 1200 was set buffer_size = 4800 0 - Front Left Write error: -32,Broken pipe Write error: -32,Broken pipe ALSA lib pcm_aaf.c:670:(aaf_tx_pdu) Failed to send AAF PDU Write error: -5,Input/output error xrun_recovery failed: -5,Input/output error Transfer failed: Input/output error

listener end is working fine sudo arecord -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D aaf0 | aplay -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D default

Recording raw data 'stdin' : Signed 16 bit Big Endian, Rate 48000 Hz, Stereo Playing raw data 'stdin' : Signed 16 bit Big Endian, Rate 48000 Hz, Stereo

Any help would be highly appreciated.

edersondisouza commented 2 years ago

Hi,

Have you configured ETF Qdisc on talker? Which parameters did you use?

Deepa-Santhosh commented 2 years ago

Yes I did. ETF configuration : sudo tc qdisc add dev enp2s0 parent 7777:1 etf clockid CLOCK_TAI delta 500000 offload

sudo tc qdisc add dev enp2s0 parent 8888:1 etf clockid CLOCK_TAI delta 500000 offload

Time synchronization is done on both the machines. Created the VLAN using sudo ip link add link enp2s0 name enp2s0.5 type vlan id 5 egress-qos-map 2:2 3:3

sudo ip link set enp2s0.5 up

Now the talker end output while running the below command :

sudo speaker-test -p 25000 -F S16_BE -c 2 -r 48000 -D aaf0

output: speaker-test 1.1.9

Playback device is aaf0 Stream parameters are 48000Hz, S16_BE, 2 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 1 to 206158430 Period size range from 0 to 206158431 Requested period time 25000 us Periods = 4 was set period_size = 1200 was set buffer_size = 4800 0 - Front Left 1 - Front Right Time per period = 5.900757 0 - Front Left 1 - Front Right Time per period = 5.999960 0 - Front Left 1 - Front Right Time per period = 5.999962 0 - Front Left 1 - Front Right Time per period = 5.999957 0 - Front Left 1 - Front Right Time per period = 5.999997 0 - Front Left 1 - Front Right Time per period = 5.999970 0 - Front Left ALSA lib pcm_aaf.c:670:(aaf_tx_pdu) Failed to send AAF PDU Write error: -5,Input/output error xrun_recovery failed: -5,Input/output error Transfer failed: Input/output error

Please help me in confirming the correctness of the configuration file ( I m not sure about the streamid) talker end :

pcm.aaf0 { type aaf ifname enp2s0.5 //vlan interface addr 68:05:ca:e7:8c:f6 //listner MAC prio 2 streamid AA:BB:CC:DD:EE:FF:000B
mtt 50000 time_uncertainty 1000 frames_per_pdu 12 ptime_tolerance 100 } listner end :

pcm.aaf0 { type aaf ifname enp4s0.5 //vlan interface addr 68:05:ca:e7:8c:ff //talker MAC prio 2 streamid AA:BB:CC:DD:EE:FF:000B
mtt 50000 time_uncertainty 1000 frames_per_pdu 12 ptime_tolerance 100 }

Thank you for your support

edersondisouza commented 2 years ago

Hi,

Stream id is fine, it's an arbitrary value and as long as you use the same on both sides, it should just work. The address is not correct, though. Address is usually the multicast address used by the stream. You could use the unicast address of the listener on both configuration files, but that's not how it's supposed to be used. Just stick to a multicast address, such as the one in the documentation (01:AA:AA:AA:AA:AA), and both (talker and listener) should join that multicast address.

Hope that helps!

Deepa-Santhosh commented 2 years ago

Hello Sir, Thank you for the information. AVB talker/listener is working fine in capture mode. I am able to hear the sound at the listener machine.

I am facing some issue in playback mode, I have attached the screenshot FYR.

Playback_error

Thank you for your support.

edersondisouza commented 2 years ago

What do you mean by "playback mode"? To me, this is just the mode used on the talker, in which ALSA "plays" the audio to the network. You mentioned that you are able to hear the audio at the listener - meaning that "capture mode" also works. From the screenshot, it appears that you are also trying to play the sound using the "converter0" device - have you created it? Are you sure you need it? In the documentation, this device is used to play the big endian file supplied on cards that only accept little endian (https://tsn.readthedocs.io/avb.html#troubleshooting).

Deepa-Santhosh commented 2 years ago

Hi,

Thank you for the information.

Yes converter0 device is not needed in my case.

I have not included it in the configuration file (/etc/asound.conf). If I use the device default instead of converter0, I still see the same error as shown in the screenshot attached in the previous comment

Command used at the listener end : sudo arecord -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D aaf0 | \ aplay -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D default

I am able to hear the sound and see some encrypted messages being displayed on the screen if I run the below command : sudo arecord -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D aaf0

Is there any problem with aplay?

Thank you for your support.

edersondisouza commented 2 years ago

I'm a bit puzzled by the fact you hear something with this command, then. arecord will get the packets from the network and literally output to stdout - hence the garbage you see without the | aplay. aplay should get the buffers from stdin and play in your default sound device. You can check that aplay is working fine by trying to play a file with it, or just try speaker-test. Or use aplay -l to list available devices.

Deepa-Santhosh commented 2 years ago

Hi, aplay works fine with sudo permission. sudo arecord -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D aaf0 | sudo aplay -F 25000 -t raw -f S16_BE -c 2 -r 48000 -D default

Here is the output using wireshark

image

Output analyzed using tcpdump

image

Kindly confirm me the correctness of the output.

edersondisouza commented 2 years ago

I can't say for sure, but it looks ok. If you did hear what you played with no issues, I guess you got it!

Deepa-Santhosh commented 2 years ago

Thank you for your help and support @edersondisouza I am closing this issue