(Not quite) understanding the appsrc

Sebastian Dröge sebastian at centricular.com
Wed Feb 17 15:53:50 UTC 2016


On Mi, 2016-02-17 at 15:06 +0100, Florian Echtler wrote:
> Hello Sebastian,
> 
> On 16.02.2016 09:08, Sebastian Dröge wrote:
> > On Mo, 2016-02-08 at 21:31 +0100, Florian Echtler wrote:
> > > [...]
> > >   /* setup appsrc */
> > >   g_object_set (G_OBJECT (appsrc),
> > >     "stream-type", 0, // GST_APP_STREAM_TYPE_STREAM
> > >     "format", GST_FORMAT_TIME,
> > >     "is-live", TRUE,
> > >     "min-latency", 0,
> > >     "max-latency", gst_util_uint64_scale_int (1, GST_SECOND, 30),
> > >     "do-timestamp", TRUE,
> > >   NULL);
> > >  
> > > As mentioned above, this works as intended. However, the whole
> > > program leaks memory like crazy (the buffers _are_ freed
> > > correctly,
> > > but not as fast as new ones are created) and the output starts
> > > lagging more and more badly. AFAICT the appsrc can be told to
> > > discard
> > > old buffers to keep up, but seems to be queueing them instead.
> > > 
> > > Would be grateful for any hints on how to fix this (maybe using
> > > min-latency and max-latency?)
> > 
> > The latency settings you have there don't make much sense and you
> > should better keep the defaults :)
> 
> OK :-) Is there any additional documentation for these properties
> besides the one-liners in the FDO docs? From that documentation
> alone, I have obviously misunderstood them completely...

Check the documentation about latency. LATENCY query and in
docs/design.

> > So the question here is why and where buffers are piling up. appsrc
> > only should buffer up to a frame or 200kb (whichever comes first)
> > of
> > buffers, so in your case one frame. You can check that with the
> > "current-level-bytes" property. However it only does that if
> > "block" is
> > set to TRUE (the default is FALSE), otherwise it assumes that you
> > listen to the "enough-data" signal and stop pushing data until it
> > reports "need-data" again.
> > 
> > So try setting "block" to TRUE and see if that helps in your case.
> 
> Yes, that indeed seems to have done the trick. Thanks for your help!

That probably should be made more explicit in the docs. Want to provide
a patch for that? :)

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160217/27c65e22/attachment.sig>


More information about the gstreamer-devel mailing list