GNOME Bugzilla – Bug 589314
[basetransform] clears GAP flag in passthrough mode
Last modified: 2009-07-23 05:56:26 UTC
The progressreport element is clearing the gap flags on buffers passed through it. It should be a pure pass-through element, and not modify the buffers. This can be fixed by calling gst_base_transform_set_gap_aware() in the element's init method.
Created attachment 138958 [details] [review] call gst_base_transform_set_gap_aware() in progressreport's init method
Created attachment 138965 [details] [review] basetransform-passthrough-gap.diff If acting in passthrough mode basetransform should keep the GAP flag, the elements can't change the buffer content anyways.
I'll commit this after freeze.
commit be2a6bb6a9fa1418d35454bc853a8383832aaa82 Author: Sebastian Dröge <sebastian.droege@collabora.co.uk> Date: Wed Jul 22 09:01:56 2009 +0200 basetransform: Don't unset GAP flag if working in passthrough mode Fixes bug #589314.
Is this a good approach? Initially I was going to submit this as a basetransform bug, too, but then I thought that even a pass-through element might not be gap-aware. For example, a pass-through element might be doing something with the data as is goes through, like measuring a spectrum or something, and the element might not know what to do with a gap. It seems to me that "is pass-through" and "is gap aware" really are two independent properties of an element. Maybe what should happen is that "is pass-through" and "is gap-aware" should remain independent properties of a sub-class, but a check should be added to the basetransform class that if a sub-class has set the pass-through flag and has *not* set the gap-aware flag and a gap buffer is seen on the sink pad, then the basetransform class raises a "not supported" error. That way elements that are not gap aware are prevented from accidentally processing data they don't understand, and if an element is gap aware but its maintainer has forgotten to say so in the init method then they'll find out from the error message and be reminded to fix it.
GAP aware and passthrough are two different properties but passthrough implies GAP aware (not the other way around). A passthrough element will never (and can't) change the content of the buffers, i.e. the output buffers will still contain silence if the GAP flag was set and there's no reason to unset it. The reason why the GAP aware mode exists is only to make sure that the output buffers only contain the GAP flag if the elements make sure that the buffers only have a GAP flag if they really contain silence. For a passthrough element this is always true and if the element understands the GAP flag or not doesn't matter, a buffer with GAP flag must contain silence.