problem with synchronization between multiple audio clients
Henrik Kjær Nielsen
henrikkjaernielsen at hotmail.com
Wed Apr 30 05:22:41 PDT 2014
I am also very interested in using GStreamer to stream synchronized audio
(and video) to multiple clients.
Now that the new gst-rstp-server v. 1.2.3 has been out for some time, I hope
that somebody is willing to share some information on how to prepare a
simple synchronization experiment as a proof of concept. I have not been
able to find any hints on how to do this except from what has been written
in this thread. This is what I did so far:
I have created a simple rtsp server based on example code from the source
repository:
#include <gst/gst.h>
#include <gst/rtsp-server/rtsp-server.h>
static void
media_configure(GstRTSPMediaFactory * factory, GstRTSPMedia * media)
{
gst_rtsp_media_use_time_provider(media, TRUE);
}
int main(int argc, char *argv[])
{
GMainLoop *loop;
GstRTSPServer *server;
GstRTSPMountPoints *mounts;
GstRTSPMediaFactory *factory;
GstRTSPAddressPool *pool;
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();
gchar *str;
str = g_strdup_printf("( "
"filesrc location=%s ! qtdemux name=d "
"d. ! queue ! rtph264pay pt=96 name=pay0 "
"d. ! queue ! rtpmp4apay pt=97 name=pay1 " ")", argv[1]);
gst_rtsp_media_factory_set_launch(factory, str);
g_free(str);
gst_rtsp_media_factory_set_shared(factory, TRUE);
g_signal_connect(factory, "media-configure", (GCallback)media_configure,
NULL);
/* attach the test factory to the /test url */
gst_rtsp_mount_points_add_factory(mounts, "/test", 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_print("stream ready at rtsp://127.0.0.1:8554/test\n");
g_main_loop_run(loop);
return 0;
}
As suggested earlier in this thread, I call
gst_rtsp_media_use_time_provider(media, TRUE).
On the clients (I am running multiple client instances on the same computer
as the rtsp server instance) I simply run gst-launch-1.0 -v playbin
uri="rtsp://127.0.0.1:8554/test".
Well, it does not work, i.e. the audio (and video) is not synchronized.
Calling gst_rtsp_media_use_time_provider(media, TRUE) has no effect. The
audio is slightly misaligned when running two client instances
simultaneously - it sounds a bit like bathroom acoustics.
What do I have to do to make it synchronized? My platform is Windows.
Regards
Henrik
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/problem-with-synchronization-between-multiple-audio-clients-tp4663231p4666673.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list