Commit 5fefa954 authored by Max Kellermann's avatar Max Kellermann

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.
parent 4eadb0f7
...@@ -428,8 +428,14 @@ static void do_play(void) ...@@ -428,8 +428,14 @@ static void do_play(void)
} else if (decoder_is_idle()) { } else if (decoder_is_idle()) {
break; break;
} else { } 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");*/ /*DEBUG("waiting for decoded audio, play silence\n");*/
if (playAudio(silence, CHUNK_SIZE) < 0) if (playAudio(silence, num_frames * frame_size) < 0)
break; break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment