diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index c67aca5cc5..d6e9598e55 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -495,8 +495,13 @@ static int get_space(void){ // it should round it down to outburst*n // return: number of bytes played static int play(void* data,int len,int flags){ - len/=ao_data.outburst; - len=write(audio_fd,data,len*ao_data.outburst); + if(len==0) + return len; + if(len>ao_data.outburst || !(flags & AOPLAY_FINAL_CHUNK)) { + len/=ao_data.outburst; + len*=ao_data.outburst; + } + len=write(audio_fd,data,len); return len; }