fix infinity loop bug when playing files with different sample rate