player: don't send partial frames of silence
Another partial frame fix: the silence buffer was 1020 bytes, which had room for 127.5 24 bit stereo frames. Don't send the partial last frame in this case.
This commit is contained in:
parent
4eadb0f7aa
commit
5fefa954a3
|
@ -428,8 +428,14 @@ static void do_play(void)
|
|||
} else if (decoder_is_idle()) {
|
||||
break;
|
||||
} else {
|
||||
size_t frame_size =
|
||||
audio_format_frame_size(&pc.audio_format);
|
||||
/* this formula ensures that we don't send
|
||||
partial frames */
|
||||
unsigned num_frames = CHUNK_SIZE / frame_size;
|
||||
|
||||
/*DEBUG("waiting for decoded audio, play silence\n");*/
|
||||
if (playAudio(silence, CHUNK_SIZE) < 0)
|
||||
if (playAudio(silence, num_frames * frame_size) < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue