resample.c: Allow NULL input buffer; update drain function.