Calculate minimum timeout based on the sample numbers and sampling frequency

For slow sampling devices we need to increase the default timeout to be able to
capture larger buffers. This patch loops over all active devices and for each
calculates the minimum timeout that is necessary to successfully capture all
data. The timeout for the context is then set to the largest minimum timeout.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>