Pulseaudio to output RTP to internet
Asked Answered
A

1

6

I want pulseaudio (remote instance) to push audio sent to the primary alsa device straight to RTP over the internet so that I could listen to it on VLC on my home computer.

in my /etc/pulse/default.pa

load-module module-rtp-send source=alsa_output.0.analog-stereo.monitor destination=x.x.x.x port=8080 loop=1

Where x.x.x.x is the internet IP of my server

After starting pulseaudio,netstat shows (I cannot connect from remote VLC to this)

udp        0      0 10.170.94.16:58606      x.x.x.x:9875      ESTABLISHED 2109/pulseaudio
udp        0      0 10.170.94.16:35597      x.x.x.x:8080      ESTABLISHED 2109/pulseaudio

It works with cvlc to produce the intended results (I can connect from remove VLC to this)

cvlc -vvv pulse://alsa_output.0.analog-stereo.monitor --sout '#transcode{acodec=mpga,ab=32,channels:1}:rtp{sdp=rtsp://0.0.0.0:8080/test.sdp}'

which produces

tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1944/pulseaudio

And I can connect to it.

So what I think I understand is that pulseaudio is working correctly, and is sending the audio to port 8080. However, it's not listening for incoming connections to route the data to. How would I tell pulseaudio, or set up the routing so that port 8080 transmits the audio provided by rtp when an inbound connection occurs. I also see that cvlc is using rtsp as the source.

Still a bit confused..

Anxiety answered 22/1, 2013 at 6:18 Comment(0)
M
0

RTP uses the stateless UDP protocol as a transport: it does not require the destination end to acknowledge any incoming packets. It cannot tell you if the connection has actually been established, other than if the remote end explicitly rejected it. This feature allows for doing broadcast on a LAN because multiple clients can listen to the packets as they wish, but it makes debugging unicast connections slightly more complicated.

When doing unicast UDP (like you are trying to achieve), once it's out on the Internet, it should get to your destination. Do you have a firewall? Unless your machine is connected directly to your modem, it is very likely that you have at least network address translation which would prevent the packets from reaching your computer. Look for port forwarding in your gateway/router configuration.

You can test if you are actually receiving the packets by using tcpdump. When running it, you will see some noise from other connections, along with packets that look like this:

08:19:38.483895 IP y.y.y.y.zzzz > x.x.x.x:8080: UDP, length 1292

Also, PulseAudio does not use RTSP, so VLC needs to open an RTP stream only. Simply typing rtp://0.0.0.0:8080 should do it.

Mordred answered 20/3, 2020 at 13:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.