<div dir="ltr"><div>I want to process audio data from an input set of buffers and make the processed audio data ready in an output set of buffers as soon as possible. I am using appsrc to get the data from the input buffers and appsink to put the data in the output buffers. My problem is this mechanism seems to introduce a delay that is comparable to the duration of the media being processed.</div><div><br></div>If I run a command line pipeline  (with gst-launch) from filesrc to filesink it completes in approx 50millisecs, e.g. <div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>gst-launch-1.0 filesrc location=input.wav ! wavparse ! audioconvert ! "audio/x-raw,format=S16LE,rate=8000" ! filesink location=output.wav</div><div><br></div><div><div>Setting pipeline to PAUSED ...</div></div><div><div>Pipeline is PREROLLING ...</div></div><div><div>Pipeline is PREROLLED ...</div></div><div><div>Setting pipeline to PLAYING ...</div></div><div><div>New clock: GstSystemClock</div></div><div><div>Got EOS from element "pipeline0".</div></div><div><div>Execution ended after 0:00:00.005366272</div></div><div><div>Setting pipeline to PAUSED ...</div></div><div><div>Setting pipeline to READY ...</div></div><div><div>Setting pipeline to NULL ...</div></div><div><div>Freeing pipeline ...</div></div></blockquote><div><br></div><div>If I implement the same pipeline programatically and run it, the behaviour is the same and the processing is complete in approx 50millisecs, </div><div>i.e. filesrc location=input.wav ! wavparse ! audioconvert ! "audio/x-raw,format=S16LE,rate=8000" ! filesink location=output.wav</div><div><br></div><div>Now if I substitute the filesrc for appsrc in my program and read data from the media file and push it into the pipeline using "push-buffer" once again the behaviour is the same and the processing is complete in approx 50millisecs, </div><div>i.e. <b>appsrc</b> ! wavparse ! audioconvert ! "audio/x-raw,format=S16LE,rate=8000" ! filesink location=output.wav</div><div><br></div><div>Finally if I substitute the filesink element with appsink and write samples received into the output media file the behaviour changes and the processing time seems to take as long as the expected duration of the media. In the example this means the processing is complete in approx 10seconds?</div><div>i.e. <b>appsrc</b> ! wavparse ! audioconvert ! "audio/x-raw,format=S16LE,rate=8000" ! <b>appsink</b><br></div><div><br></div><div>How can I get appsink (or the pipeline) to not delay the samples delivered? </div><div><br></div><div>I have tried changing the appsink approach from signal based with a callback for "new-sample" to simply having a thread that loops calling gst_sample_get_buffer() as fast as possible. No change in behaviour.</div><div><br></div><div>I have also tried fiddling with the config of appsrc (latency, size, blocksize, block, is-live, stream-type). No change in behaviour.</div><div><br></div><div>I have also tried changing the audioconvert element config (dithering, noise-shaping). No change in behaviour.</div><div><br></div><div>I have also tried changing the appsink element config (blocksize, max-buffers, emit-signals). No change in behaviour.</div><div><br></div><div>Any advice appreciated.</div><div><br></div><div>Thanks</div><div>Steve</div></div>