GNOME Bugzilla – Bug 784128
queue: enqueued buffers not pushed on flush-start or eos
Last modified: 2017-06-26 10:18:22 UTC
Hello, I have noticed that GstQueue does not push all enqueued buffers on flush-start or eos events. This make that media can be lost, which is undesired in some use cases. I have seen “flush-on-eos” property, but it does exactly the opposite: all buffers are dropped. Should we implement by default that all buffers are pushed or at least add a new property to set this behavior?
On FLUSH_START/_STOP all currently queued up buffers should be dropped, that's exactly what those events should do. Don't flush if you still need any data that is queued up somewhere. On EOS, the EOS event should be queued up in the queue and then later handled after all buffers are pushed. That's not what you observe?
Hello Sebastian!! I misunderstood the meaning of FLUSH_START/_STOP, so thanks for the clarification ;). Regarding EOS, queue enqueues it and handles it after all buffers are pushed if the pipeline is not released before. Although my problem is more complex, simplifying it at the end what I want to do is to ensure that all enqueued buffers have been pushed downstream before releasing the pipeline and this is what I think that was done by pushing FLUSH_START/_STOP + EOS events in a synchronous way. A way to reproduce it is running the same pipeline: gst-launch -v fakesrc num-buffers=10 dump=true sizemax=1 sizetype=2 ! queue ! identity sleep-time=1000000 ! fakesink dump=true and after all buffers are enqueued perform Ctrl+C. You will see that some buffers are lost. Is this the correct behavior and should I wait for sink elements to go to EOS before releasing the pipeline as gst-launch does? If yes, I have some idea to do it. Anyway, is there any doc about how to perform this in the proper way or at least any known corner case that could cause deadlocking or another problem?
What you want can be implemented by sending EOS downstream and then waiting for the sink to post the EOS message (not that this only arrives at the application bus if all sinks posted EOS, if you need to know it per sink you have to override GstBin::handle_message of the bin that is around the sink). Flushing is not needed and problematic here.
I will try it. Thanks!! :D