Original commit message from CVS: rewrite state machine in _loop() function to handle buffer durations