Adding support for buffer swapping callback