<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
Hi Andrey,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
How are you pushing data to the appsrc?  From the doc, it seems you should only push when it's requesting more data via the need-data signal.  You can maintain a buffer of your camera data separately and use that to feed into appsrc only when it's requesting
 through that signal.  Just my thoughts, might be worth a try.</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> gstreamer-devel <gstreamer-devel-bounces@lists.freedesktop.org> on behalf of Andrey Sotnikov via gstreamer-devel <gstreamer-devel@lists.freedesktop.org><br>
<b>Sent:</b> Thursday, August 24, 2023 12:10 AM<br>
<b>To:</b> gstreamer-devel@lists.freedesktop.org <gstreamer-devel@lists.freedesktop.org><br>
<b>Cc:</b> Andrey Sotnikov <usaonmonday@gmail.com><br>
<b>Subject:</b> How to provide data to RTSPClient wihout latency? [appsrc, buffering]</font>
<div> </div>
</div>
<div style="padding-bottom:1px">
<div style="display:block!important; display:block"><style type="text/css">
<!--
div
        {display:block!important}
td.x_ik-td
        {display:table-cell!important;
        background-color:#e2e3e5!important;
        border:0!important;
        padding:0!important}
span.x_ik-banner
        {display:inline!important;
        background-color:#e2e3e5!important}
span.x_ik-footer
        {display:inline!important;
        background-color:#e2e3e5!important}
span.x_ik-initial
        {display:inline!important;
        background-color:initial!important}
-->
</style><!--removed inky banner--></div>
Hi, dear GStreamer community,<br>
<br>
I am tired of parsing GStreamer's source code to understand how everything works and how to solve my problem.<br>
<br>
My company manufactures cameras. I am trying to create an application that shares the data from these cameras over RTSP. Here is the launch string for GstRTSPMediaFactory: "( appsrc name=ourcamera ! queue ! x265enc speed-preset=5 tune=4 option-string=colormatrix=gbr:lossless=true
 ! rtph265pay name=pay0 pt=96 )". When I receive a frame from my camera, I push it to appsrc. The problem is, in the beginning, appsrc buffers all the data pushed, while the connection is being established. When the real data transfer starts, this buffer is
 not being discarded, leading to a latency of dozens of seconds. I would love to push only after RTSPClient is ready to pop data, but how?<br>
<br>
I was trying to figure what was going on, and here are my discoveries. When the pipeline created for an RTSPCLient is in the play mode, gst_base_src_loop checks if reconfigure is required. For some reason, it finds out it is, and calls gst_base_src_negotiate_unlocked.
 The latter hangs on gst_base_src_prepare_allocation. This function hangs on gst_pad_query called on queue:sink and query is a new allocation. It hangs only because, for some reason, gst_queue_loop is not being called. While gst_queue_loop is postponed, my
 application continues pushing data. When finally gst_queue_loop is called, appsrc has a buffer of up to a hundred frames accumulated. So what gst_queue_loop is waiting for?<br>
<br>
I tried removing gst_queue_loop all together, but not only the latency problem remains, the pipeline reports it is not configured properly and asks to add a queue.<br>
</div>
</body>
</html>