Problem with gstreamer tee

I would like to make following circuit with gstreamer

//                                     [     ] -> [ multifilesink ]
// [ nvcamerasrc ] -> [ nvjpegenc ] -> [ tee ]
//                                     [     ] -> [ queue ] -> [multipartmux] -> [ tcpserversink]

The aim is to capture jpg pictures from camera during streaming camera onto a web client.

When I make the whole chain, the multifilesink never write file on the disk.

After tests I found that’s the fault comes from the tcpserversink.
When I don’t add it to the pipeline, the multifilesink works.

gst_bin_add_many(GST_BIN (m_pipeline), m_source, m_filter, m_jpegEncoder, m_tee, m_sink, m_streamerQueue, m_multipartMux, m_tcpServerSink, NULL);
...
if (gst_element_link_many (m_streamerQueue, m_multipartMux, m_tcpServerSink, NULL) != TRUE)
...

replaced by

gst_bin_add_many(GST_BIN (m_pipeline), m_source, m_filter, m_jpegEncoder, m_tee, m_sink, m_streamerQueue, m_multipartMux, NULL);
...
if (gst_element_link_many (m_streamerQueue, m_multipartMux, NULL) != TRUE)
...

Here is the dot output of the result

When I just add the tcpserversink, I got that

and the multifilesink doesn’t write any file like if the pipe is hanged up.

Here is the initialization code of the tcpfilesink

m_tcpServerSink = gst_element_factory_make("tcpserversink", "tcpserversink");
g_object_set(m_tcpServerSink, "host", "localhost", "port", (gint)m_cameraConfiguration->streamPort(), NULL);

Any clue ?

Hi Nicolas,

On my TX2, adding queue before multifilesink looks working:

mkdir tmpTest
cd tmpTest
gst-launch-1.0 -e nvcamerasrc num-buffers=300 ! nvjpegenc ! tee name=t ! queue ! multifilesink   t. ! queue ! multipartmux ! tcpserversink

Usually after tee, each subsequent pipeline would start with queue.

Thank @Honey_Patouceul for the sharing.

I’ve added the queue and it works thanks a lot !