2

I'm trying to send audio through an RTP Stream using gstreamer with the lowest latency possible and I want to do it from a Pepper(gstreamer 0.10) to my computer(gstreamer 0.10 or 1.0). I can send audio with little latency (20 ms) from the computer to Pepper however I doesn't work as well from the Pepper to the computer. When I try to adjust the buffer-time under 200 ms, I get this type of error :

WARNING: Can't record audio fast enough
Dropped 318 samples. This is most likely beacause downstream can't keep up and is consuming samples too slowly.

I used the answers here and so far and worked with the following pipelines:

Sender

gst-launch-0.10 -v alsasrc name=mic provide-clock=true do-timestamp=true buffer-time=20000 mic. ! \
audio/x-raw-int, format=S16LE, channels=1, width=16,depth=16,rate=16000 ! \ 
audioconvert ! rtpL16pay ! queue ! udpsink host=pepper.local port=4000 sync=false

Receiver

gst-launch-0.10 -v udpsrc port=4000 caps = 'application/x-rtp, media=audio, clock-rate=16000, encoding-name=L16, encoding-params=1, channels=1, payload=96' ! \
rtpL16depay ! autoaudiosink buffer-time=80000 sync=false

I don't really know how to tackle this issue as the CPU usage is not anormal. And to be frank I am quite new in this, so I don't get what are the parameters to play with to get low latency. I hope someone can help me! (and that it is not a hardware problem too ^^)

Thanks a lot!

am.e
  • 21
  • 4
  • So.. maybe the hardware is not capable of delivering such small chunks/latency of data? And what is a Pepper? – Florian Zwoch Jul 12 '18 at 08:02
  • Well yeah i suppose it's probably the hardware, it was just to be sure! Well it's a robot from softbank robotics! – am.e Jul 13 '18 at 08:33

1 Answers1

0

I don't think gst-launch-0.10 is made to work in real-time (RT). Please consider writing your own program (even using GStreamer) to perform the streaming from an RT thread. NAOqi OS has the RT patches included and support this.

But with network involved in your pipeline, you may not be able to guarantee it is going to be processed in time.

So maybe the simplest solution could be to keep a queue before the audio processing of the sender:

gst-launch-0.10 -v alsasrc name=mic provide-clock=true do-timestamp=true buffer-time=20000 mic. ! \
audio/x-raw-int, format=S16LE, channels=1, width=16,depth=16,rate=16000 ! \ 
queue ! audioconvert ! rtpL16pay ! queue ! udpsink host=pepper.local port=4000 sync=false

Also consider that the receiver may cause a drop if it cannot process the audio in time, and that a queue might help too:

gst-launch-0.10 -v udpsrc port=4000 caps = 'application/x-rtp, media=audio, clock-rate=16000, encoding-name=L16, encoding-params=1, channels=1, payload=96' ! \
rtpL16depay ! queue ! autoaudiosink buffer-time=80000 sync=false
Victor Paléologue
  • 2,025
  • 1
  • 17
  • 27