stream: fix off-by-one error in findSegments, and add docs