GNOME Bugzilla – Bug 748946
videoaggregator: add "ignore-eos" property to input pads to ignore EOS
Last modified: 2015-06-12 19:51:41 UTC
Created attachment 302921 [details] [review] videoaggregator: New property 'aggregate-eos' Description: When a videoaggregator pad with this property set receives EOS, instead of going EOS, it will keep passing the last frame to the aggregator; effectively causing the pad to continue to "aggregate (despite) eos". This is useful in a number of cases, such as: 1) Implementing a "slideshow" with a specific list of pictures being displayed one after the other for a specific amount of time each. One can send a single frame which will be repeated instead of generating multiple frames to send to videoaggregator. 2) Implementing an application that has to seamlessly switch between multiple video files—repeating the last frame for 1-2 frames helps avoid the aggregator falling back to generating a "background" frame (which is a black/white/checkerboard pattern frame) while the next pad is connected. Repeating 1-2 frames is almost unnoticeable, but a black frame is immediately noticeable as a glitch. In theory, this can be avoided by connecting the next pad in advance and setting the correct pad offset, but in reality, with A/V files one has to ensure that the audio is stitched perfectly, and that usually means that the video cannot be, and one needs to repeat/drop frames to keep A/V sync. Obvious caveat: If one sets all the sink pads of a videoaggregator to "aggregate-eos", the element will never pass on EOS downstream, and the pipeline will never stop playing. One has to either take care and not set that on the last pad that will be requested on the element, or manually send an EOS event to the element.
I know no one expected this, but I think we can probably find a better / more concise name for this property ;) How about just "ignore-eos"? This doesn't convey the fact that we will still EOS if all the non-ignore pads are EOS (we will, won't we?), but at least it's clear what it does if you set it.
(In reply to Tim-Philipp Müller from comment #1) > I know no one expected this, but I think we can probably find a better / > more concise name for this property ;) > > How about just "ignore-eos"? This doesn't convey the fact that we will still > EOS if all the non-ignore pads are EOS (we will, won't we?), but at least > it's clear what it does if you set it. I like "ignore-eos". More concise and a better description of what will happen. :) I'll wait a day for more suggestions and then attach a patch with that change. However, we will *not* EOS if all the non-ignore pads are EOS. videoaggregator only forwards EOS when all the pads are EOS, so if one of the pads will never go EOS (because we set "ignore-eos"), videoaggregator will not go EOS till that pad is removed. I think this behaviour is actually a feature and is consistent with how the element already behaves. Besides that, I think it would be annoying to have to add a pad probe to every non-ignore-eos pad and catch the EOS there to avoid the element going EOS despite asking that it not go EOS till all the "ignore-eos" pads are removed (or the property flipped).
Created attachment 303080 [details] [review] videoaggregator: New property 'ignore-eos' Rename to ignore-eos
Created attachment 303104 [details] [review] videoaggregator: New property 'ignore-eos' Forgot to `git add gstvideoaggregatorpad.h`.
This property deserves a test of its own. I'm working on that.
Created attachment 304747 [details] [review] tests: Add a check for the new videoaggregator ignore-eos pad property This test uses the compositor element to test the videoaggregator pad property.
Pushed, thanks (with one minor modification - I changed the log message a little so it's clearer): commit 220a1334792d8ff40f00df05e83918a77f5eef5a Author: Nirbheek Chauhan <nirbheek@centricular.com> Date: Sat Jun 6 20:40:13 2015 +0530 tests: Add test for the 'ignore-eos' compositor sink pad property When the 'ignore-eos' property is set on a pad, compositor will keep resending the last buffer on the pad till the pad is unlinked. We count the buffers received on appsink, and if it's more than the buffers sent by videotestsrc, the test passes. commit b395c055ebd47a724fd2bc815d525cee531f25ba Author: Nirbheek Chauhan <nirbheek@centricular.com> Date: Tue Feb 10 00:49:35 2015 +0530 videoaggregator: add "ignore-eos" property for input pads When set, it causes videoaggregator to repeatedly aggregate the last buffer on an EOS pad instead of skipping it and outputting silence. This is useful, for instance, while playing back files seamless one after the other, to avoid videoaggregator ever outputting silence (the checkerboard pattern). It is to be noted that if all the pads on videoaggregator have this property set on them, the mixer will never forward EOS downstream for obvious reasons. Hence, at least one pad with 'ignore-eos' set to FALSE must send EOS to the mixer before it will be forwarded downstream. https://bugzilla.gnome.org/show_bug.cgi?id=748946