Fix issue when calling `buffer.samples()` multiple times with the same buffer