To provide 2 mountpoints for GstRTSPServer
watertreader
watertreader at hotmail.com
Thu Apr 15 07:28:58 UTC 2021
Hi
I have try to modify /test-readme.c in the Github program. to test for two
independent pipeline to be mounted on the same server
1) videotestsrc pattern=snow ! vpuenc_h264 ! rtph264pay name=pay0 pt=96
2) videotestsrc pattern=pinwheel ! vpuenc_h264 ! rtph264pay name=pay1 pt=97
but I couldnt get the stream.
However when I changed the rtph264pay name to be pay0 for both 1 and 2.
There I could get stream from video but only from the latter pipeline... It
seem that latter pipeline overwritten the older pipeline
Can I know is my approach correct?
Below is my code
=================== CODE ======================
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
int
main (int argc, char *argv[])
{
GMainLoop *loop;
GstRTSPServer *server;
GstRTSPMountPoints *mounts;
GstRTSPMediaFactory *factory;
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
/* create a server instance */
server = gst_rtsp_server_new ();
/* get the mount points for this server, every server has a default object
* that be used to map uri mount points to media factories */
mounts = gst_rtsp_server_get_mount_points (server);
/* make a media factory for a test stream. The default media factory can
use
* gst-launch syntax to create pipelines.
* any launch line works as long as it contains elements named pay%d. Each
* element with pay%d names will be a stream */
factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory,
"( videotestsrc pattern=snow ! vpuenc_h264 ! rtph264pay name=pay0
pt=96 )");
gst_rtsp_media_factory_set_shared (factory, TRUE);
/* attach the test factory to the /test url */
gst_rtsp_mount_points_add_factory (mounts, "/test0", factory);
gst_rtsp_media_factory_set_launch (factory,
"( videotestsrc pattern=pinwheel ! vpuenc_h264 ! rtph264pay
name=pay1 pt=97 )");
gst_rtsp_media_factory_set_shared (factory, TRUE);
/* attach the test factory to the /test url */
gst_rtsp_mount_points_add_factory (mounts, "/test1", factory);
/* don't need the ref to the mapper anymore */
g_object_unref (mounts);
/* attach the server to the default maincontext */
gst_rtsp_server_attach (server, NULL);
/* start serving */
g_main_loop_run (loop);
return 0;
}
============== CODE ===================
Regards
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list