Confused about RTSP multicast example

I’m confused about the RTSP multicast example: https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-multicast.c

I thought this was setting up an RTSP stream on multicast from 224.3.0.0 to 224.3.0.10 with ports 5000 to 5010, but at the end it prints out:
stream ready at rtsp://127.0.0.1:8554/test
If I want to use VLC to test this shouldn’t I use something like:
vlc udp://@224.3.0.0:5000
?

You are confusing the service address with the RTP/RTCP connection address.

  1. The RTSP server listens for new connection requests from clients on the service address. In your example this is 127.0.0.1:8554
  2. A new client sends a request to the service address .
  3. The SDP handshake is performed between the server/client to discover the common capabilities.
  4. If successful, the server will assign the client a new unique address pair: one for the RTP data (media content) and another for the RTCP (control content). In your example, these would be taken from the multicast addresses you specified in the pool.

In short, clients still request a stream to rtsp://127.0.0.1:8554/test but the actual RTP packets of the stream travel through the multicast address. A tool like wireshark can verify this behavior.

3 Likes

GStreamer development has moved to the gstreamer monorepo now, so the latest version of this example can be found at subprojects/gst-rtsp-server/examples · main · GStreamer / gstreamer · GitLab these days for what it’s worth (not that much has changed recently).

1 Like

Is there any documentation on the difference between the two examples?

The example is the same in both links, it has not been changed. However the latest version of the gst-rtsp-server code is the one in the monorepo (the one that @tpm shared). You should be looking at that one instead.

But in that repo there’s a test-multicast.c and a test-multicast2.c. Would be useful to have documentation for them.

Ah! my bad. I’m not aware of any documentation about the examples. But if it is of any help:

  • test-multicast.c: shows how to provide a pool of multicast addresses and let the server use it to automatically assign them to clients and their streams. Use this if you don’t care which client/stream is assigned to which address/ports (most typical scenario I would say).
  • test-multicast2.c: shows how to assign each individual stream a specific multicast address. Use this if you need to have control of which client/stream is assigned to which address/ports.
1 Like