The priv->clock_rate variable could become -1 between when its checked to not be -1 and when its used, causing an assertion. Fixed by taking the mutex earlier in the chain() function. Fixes #593955