gstreameraudio-streamingrtsp

Sending L16 audio over RTSP in GStreamer


I'm trying to send raw audio in the L16 format over RTSP. I'm using the following pipelines for the server and client respectively. I eventually plan to add video to these pipelines as well.

Server:
./test-launch.out "filesrc location=L16.raw ! audioconvert ! audio/x-raw,format=S16BE,channels=2,rate=44100 ! rtpL16pay pt=96 name=pay0"

Client:
gst-launch-1.0 rtspsrc location=rtsp://localhost:8554/test latency=150 ! queue ! rtpL16depay ! autoaudiosink

I run into the following error when I try to use these pipelines.

ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unhandled error
Additional debug info:
../gst/rtsp/gstrtspsrc.c(6795): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Service Unavailable (503)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Here's the really strange bit: if I change the server to use audiotestsrc instead of filesrc, as shown below, everything works fine.

Server:
./test-launch.out "audiotestsrc ! audioconvert ! audio/x-raw,format=S16BE,channels=2,rate=44100 ! rtpL16pay pt=96 name=pay0"

Client:
Unchanged

I initially thought this could be due to the file that I am reading from being corrupted in some way, but I have verified that is not the case. Why does reading from a file break everything?

I'd really appreciate any help. I'm new to GStreamer and have no idea how to even begin approaching this. Any help would be much appreciated!


Solution

  • It seems like I've got the answer, thanks to Florian Zwoch's insightful comment. I was missing a rawaudioparse element on the server and client. My updated pipelines are as follows:

    Server
    ./test-launch.out "filesrc location=L16.raw ! rawaudioparse use-sink-caps=false format=pcm pcm-format=s16be sample-rate=44100 num-channels=2 ! audioconvert ! rtpL16pay pt=96 name=pay0"

    Client
    gst-launch-1.0 rtspsrc location=rtsp://localhost:8554/test latency=150 ! queue ! rtpL16depay ! rawaudioparse use-sink-caps=false format=pcm pcm-format=s16be sample-rate=44100 num-channels=2 ! audioconvert ! audioresample ! autoaudiosink

    To be completely honest, I'm not sure why this was required for a filesrc but not required for an audiotestsrc, but it works, so I'm going to stop questioning it.