basetransform: Fix race when toggling passthrough
Submitted by Stian Selnes
This fixes a race where priv->passthrough is changed from TRUE to FALSE
while processing a buffer and we end up passing a non-writable buffer to
transform_ip(). More precicely if passthrough is changed just after
prepare_output_buffer() is finished.
Since priv->passthrough and other priv variables are accessed throughout
the chain function a lock is introduced and held while processing the
buffer, but released before pushing downstream. Since sub-classes may
call is_passthrough() and similar functions during for instance
transform_ip() a recursive lock is needed.