UDP re-stream over RTSP server

Lóránt Labádi lorant.labadi at dexonsystems.com
Wed Sep 25 08:38:41 UTC 2019


Hello!

I would like to use this framework to re-stream an UDP stream (h264 
stream from ffmpeg) without transcoding and videoscaling like a RTSP 
media server.

I wrote a code as for samples, but it does not work stable, sometimes it 
works and sometimes it doesn't while the udp source is stable and working.

What did I do wrong or is it possible operation what I want?

BR.

Labi

    t_server serv;
    guint id;

    gst_init(NULL, NULL);

    serv.loop = g_main_loop_new(NULL, FALSE);
    serv.server = gst_rtsp_server_new();
    serv.mounts = gst_rtsp_server_get_mount_points(serv.server);

    gst_rtsp_server_set_address(serv.server, "192.168.1.132");
    gst_rtsp_server_set_service(serv.server, "8001");

    gchar sessionid[256];
    sprintf(sessionid, "Session_%d_%d", GetTickCount(), rand());

    auto &&session = gst_rtsp_session_new(sessionid);
    gst_rtsp_session_prevent_expire(session);

    serv.factory = gst_rtsp_media_factory_new();

    gst_rtsp_media_factory_set_shared(serv.factory, FALSE);
    gst_rtsp_media_factory_set_latency(serv.factory, 2000);

    gst_rtsp_mount_points_add_factory(serv.mounts, "input", serv.factory);

    g_object_unref(serv.mounts);

    gst_rtsp_media_factory_set_launch(serv.factory, "uridecodebin
    uri=udp://224.0.1.1:1001 ! rtph264pay config-interval=1 name=pay0
    pt=96");

    if (id=gst_rtsp_server_attach(serv.server, NULL) == 0)
    {
         return -1;
    }

    GMainContext *glib_context = g_main_context_default();

    bool quit_indicator = false;
    while (quit_indicator == false)
    {
         g_main_context_iteration(glib_context, /*allow blocking=*/false);
    }

    /* cleanup */
    g_main_loop_quit(serv.loop);
    g_source_remove(id);
    g_object_unref(serv.server);
    g_main_loop_unref(serv.loop);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190925/3406b348/attachment.html>


More information about the gstreamer-devel mailing list