Gstreamer Stream Audio

Make sure a module-null-sink with the name “mic.monitor” is available.

You may want to create such a device at startup.

Pulse

vi ~/.config/pulse/default.pa
.include /etc/pulse/default.pa
load-module module-null-sink sink_name=recording sink_properties=device.description=recording

Sender

It is done with the RTP protocol to ensure lost packages are sent again.

#!/bin/bash
echo "gstSender.sh"

GSTPID=""

gst_exit () {
        kill $GSTPID
}

gst-launch-1.0 pulsesrc device="recording.monitor" ! 'audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)48000, channels=(int)2' ! audioconvert ! opusenc ! rtpopuspay pt=96 ! rtprtxqueue ! .send_rtp_sink_0 rtpbin name=rb rtp-profile=avpf .send_rtp_src_0 ! udpsink host=192.168.0.10 port=5106 sync=false rb.send_rtcp_src_0 ! udpsink host=192.168.0.10 port=5111 sync=false async=false udpsrc port=5111 ! rb.recv_rtcp_sink_0 &
GSTPID=$!

trap gst_exit INT
trap gst_exit HUP

wait $GSTPID
exit 0

Receiver

#!/bin/bash
echo "gstSpeaker.sh"

GSTPID=""

gst_exit () {
        kill $GSTPID
}

gst-launch-1.0 udpsrc port=5106 ! 'application/x-rtp, media=(string)audio, clock-rate=(int)48000, encoding-name=(string)OPUS, payload=(int)96' ! .recv_rtp_sink_0 rtpbin name=rb rtp-profile=avpf do-lost=true do-retransmission=true ! rtpopusdepay ! opusdec ! audioconvert ! autoaudiosink udpsrc port=5111 ! rb.recv_rtcp_sink_0 rb.send_rtcp_src_0 ! udpsink host=192.168.0.9 port=5111 sync=false async=false &
GSTPID=$!

trap gst_exit INT
trap gst_exit HUP

wait $GSTPID
exit 0

Reach out to me for professional support!

Contact