GNOME Bugzilla – Bug 654853
multifilesrc: always honour stop-index
Last modified: 2012-10-26 10:02:14 UTC
Created attachment 192195 [details] [review] the patch Hi. When the file pattern for multifilesrc is specified without the template elements (that is, no % sign), the stop_index gets ignored, resulting in a tight loop. It turned out, the loop handling got a separate piece of code, that triggers only when the next file is not found. Another wrap-around checking code, that is activated when the file is found, did not check the loop argument, and appears to be buggy: it checks stop_index off-by-2. I don't think that the two separate pieces of code for the same purpose are necessary. The attached patch removes the redundant code and fixes the rest. Note that I haven't tested the patch properly. The only thing I needed was to fix the aforementioned tight loop, but I hope the patch is good. :)
Right, so I think you're onto something here, and I've committed part of your patch. However, I have not committed the bits that touch the file-not-found-or-read-error bits, because it doesn't look right to me to just remove it. That code looks useful, in the sense that it makes sure that if we're in loop mode and wrap around to the start, and there's no start file, we don't end up in a loop. Also, it handles the looping case from START-X where the stop-index is not known and we just wrap around when the next file can't be found. commit 40117be0605e447a3321897c52e37e885b12249e Author: Tim-Philipp Müller <tim@centricular.net> Date: Fri Oct 26 10:55:28 2012 +0100 tests: add multifilesrc test for fix in previous commit Make sure the stop-index set is honoured. https://bugzilla.gnome.org/show_bug.cgi?id=654853 commit 3f2363fa57bea944686e37abf5e937e8947ada06 Author: Stas Sergeev <stsp@aknet.ru> Date: Fri Oct 26 10:33:03 2012 +0100 multifilesrc: fix stop index handling Make sure the stop index is always honoured. Avoids endless loop if one wants to read and output the same file N times, for example. https://bugzilla.gnome.org/show_bug.cgi?id=654853