GNOME Bugzilla – Bug 540215
decodebin does not insert a queue for raw data type
Last modified: 2008-07-06 23:21:51 UTC
Please describe the problem: Sometimes pipeline stalls. It always happens at the beginning of playback (in prerolling stage) of a Matroska file with plaintext (S_TEXT/UTF8) subtitles without a subtitle in the first few seconds. To reproduce, simply run playbin with such file. Decodebin inserts queue elements between a demuxer and a decoder. It keeps a list of these queues. If one of them overflows, it is enlarged, BUT only if one of the other queues is empty. The idea is (as I understand it), that if all the queues are not empty the pipeline can proceed. For this reason, it is very important that every path from the demuxer to the outside of the bin contains at least one queue. If it is not the case, the above condition (all queues but one are not empty) can not be checked correctly. For example, textoverlay processes video frames only if it has seen all the earlier text frames. What happens? 1. The default video queue in decodebin is very short (8192 bytes) and it gets overflown very quickly. 2. Textoverlay has not seen enough text frames yet and cannot render. It has read all the available text frames and is blocked in video_chain function. 3. Demuxer can not provide more text frames because it is blocked pushing video frame into the overflown queue. 4. Decodebin knows that video queue is overflown but it does not enlarge it because, surprise, all the other queues are not empty. This happened because there is no queue in the text path. Demuxer provides a text/plain pin and decodebin simply created a ghost pad for it. The proposed solution is to insert a queue after pins that are currenly directly mapped to ghost pads. They are the pins for with mimetype_is_raw() is TRUE. Steps to reproduce: 1. Get a file described earlier 2. Run it with playbin 3. Enjoy the silence Actual results: Pipeline blocks. Expected results: The file plays as intended. Does this happen every time? Yes. It might be not trivial to cook such file, because it has to have some heavy video frames to overfill the queue in the first 0.5 seconds. After that, matroskademux will send a NEWSEGMENT event, allowing textoverlay to progress. Other information:
Created attachment 113434 [details] [review] proposed patch This patch fixes the problem by attaching queues to demuxer pins with raw type. Unfortunately, it adds a little bit of code duplication.
decodebin2 doesn't have this issue FYI, since all streams of a group go through a multiqueue.
Thanks, I've committed this now with some smaller changes (added debug output before the queue is linked in and unref'd the queue's srcpad after use): 2008-07-07 Sebastian Dröge <sebastian.droege@collabora.co.uk> Patch by: Evgeniy Stepanov <eugeni dot stepanov at gmail dot com> * gst/playback/gstdecodebin.c: (add_raw_queue), (close_pad_link): Add a queue after a demuxer if the demuxer outputs raw data. This was done before only for non-raw data but is required in this case too. Fixes bug #540215. decodebin2 doesn't have this issue because all streams of a group go through multiqueue.