GNOME Bugzilla – Bug 324807
GstBin: re-enable duration caching
Last modified: 2018-11-03 12:12:25 UTC
Something seems to be wrong with duration query caching in bins. I've got a playbin using a cd audio source. When the source changes tracks, it posts a new DURATION message on the bus with the duration of the new track. That should clear the existing cached durations, yet further gst_element_query (playbin, ...) after that return the same duration as previous calls. Haven't had a chance to look into it yet. Things work fine though if I comment out the block where it returns cached durations in gstbin.c, gst_bin_query().
Thanks for taking the time to report this bug. This bug report isn't very useful because it doesn't describe the bug well. If you have time and can still reproduce the bug, please read http://bugzilla.gnome.org/bug-HOWTO.html and add a more useful description to this bug.
alfredoj69: Tim described it well enough--he even pointed out a workaround by saying what part of the code to modify.
So, here's roughly what I think happens (schematically): - playbin contains, say, - bin1 with the source and decoder - bin2 bin with volume ! audioconvert ! audiosink now, the source posts a DURATION message, which clears all cached durations for bin1 and then clears all cached durations for bin2. However, the cached durations from bin2 will not be cleard. So then, next time one does gst_element_query_duration (playbin, ....) there is no cached query, so the bin will pass the query on to its children. If that child is bin2, it will return the outdated previously cached query. Not sure what the right solution for this is. Maybe have all elements post a duration message on the bus whenever they come across a NEW_SEGMENT event maybe? Or introduce some kind of gst_bin_clear_cached_durations() which a bin calls on all children that are bins after clearing its own cached durations.
I've disabled duration query caching in bins for the time being (just in case anyone tries to reproduce the problem with current CVS ;)).
interesting... looks like query caching should only be done by toplevel bins (possibly only GstPipeline). It's quite important to have this caching working as for very precise time reporting (NLE) this needs to be *FAAAST*, we don't want to dive into the pipeline for each query.
Before re-enabling this we should also a look at the usual suspects like mad/mpegdemux etc. to make sure they emit DURATION messages when the duration changes by more than ~1 second (or whatever value).
bah.. what about the unusual suspects? Andy suggests making a list of plugins and fix them at the same time.
Is this bug obsolete?
It was obsolete for a while, but it's not obsolete any longer. Duration caching has been disabled in GstBin because of the duration message changes. It needs to be re-implemented. Should just cache durations in various formats and throw away all cached durations in all formats on duration-changed messages.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/4.