Commit da022f97 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #5023 from jaxxzer/video-sink-sync

Video sink sync
parents 098477ef ce3cba6e
...@@ -183,6 +183,7 @@ void VideoReceiver::start() ...@@ -183,6 +183,7 @@ void VideoReceiver::start()
GstElement* parser = NULL; GstElement* parser = NULL;
GstElement* queue = NULL; GstElement* queue = NULL;
GstElement* decoder = NULL; GstElement* decoder = NULL;
GstElement* queue1 = NULL;
do { do {
if ((_pipeline = gst_pipeline_new("receiver")) == NULL) { if ((_pipeline = gst_pipeline_new("receiver")) == NULL) {
...@@ -225,11 +226,6 @@ void VideoReceiver::start() ...@@ -225,11 +226,6 @@ void VideoReceiver::start()
break; break;
} }
if ((decoder = gst_element_factory_make("avdec_h264", "h264-decoder")) == NULL) {
qCritical() << "VideoReceiver::start() failed. Error with gst_element_factory_make('avdec_h264')";
break;
}
if((_tee = gst_element_factory_make("tee", NULL)) == NULL) { if((_tee = gst_element_factory_make("tee", NULL)) == NULL) {
qCritical() << "VideoReceiver::start() failed. Error with gst_element_factory_make('tee')"; qCritical() << "VideoReceiver::start() failed. Error with gst_element_factory_make('tee')";
break; break;
...@@ -240,11 +236,21 @@ void VideoReceiver::start() ...@@ -240,11 +236,21 @@ void VideoReceiver::start()
break; break;
} }
gst_bin_add_many(GST_BIN(_pipeline), dataSource, demux, parser, _tee, queue, decoder, _videoSink, NULL); if ((decoder = gst_element_factory_make("avdec_h264", "h264-decoder")) == NULL) {
qCritical() << "VideoReceiver::start() failed. Error with gst_element_factory_make('avdec_h264')";
break;
}
if ((queue1 = gst_element_factory_make("queue", NULL)) == NULL) {
qCritical() << "VideoReceiver::start() failed. Error with gst_element_factory_make('queue') [1]";
break;
}
gst_bin_add_many(GST_BIN(_pipeline), dataSource, demux, parser, _tee, queue, decoder, queue1, _videoSink, NULL);
if(isUdp) { if(isUdp) {
// Link the pipeline in front of the tee // Link the pipeline in front of the tee
if(!gst_element_link_many(dataSource, demux, parser, _tee, queue, decoder, _videoSink, NULL)) { if(!gst_element_link_many(dataSource, demux, parser, _tee, queue, decoder, queue1, _videoSink, NULL)) {
qCritical() << "Unable to link elements."; qCritical() << "Unable to link elements.";
break; break;
} }
......
...@@ -50,6 +50,7 @@ GstElement* VideoSurface::videoSink() ...@@ -50,6 +50,7 @@ GstElement* VideoSurface::videoSink()
qCritical("Failed to create qtquick2videosink. Make sure it is installed correctly"); qCritical("Failed to create qtquick2videosink. Make sure it is installed correctly");
return NULL; return NULL;
} }
g_object_set(G_OBJECT(_data->videoSink), "sync", gboolean(false), NULL);
g_signal_connect(_data->videoSink, "update", G_CALLBACK(onUpdateThunk), (void* )this); g_signal_connect(_data->videoSink, "update", G_CALLBACK(onUpdateThunk), (void* )this);
_refed = true; _refed = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment