1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

aplay: Fixed incomplete playback of files

aplay used to quit as soon as the last enqueue of new buffer data
was sucessful. Because the connection closes as soon as the
application quits, samples were still in the buffer of the
ASBufferQueue as playback was halted.
This commit is contained in:
Till Mayer 2019-10-19 19:15:40 +02:00 committed by Andreas Kling
parent 406aabff23
commit 02e787f8a4
Notes: sideshowbarker 2024-07-19 11:37:55 +09:00

View file

@ -24,12 +24,16 @@ int main(int argc, char** argv)
printf("\033[34;1mProgress\033[0m: \033[s");
for (;;) {
auto samples = loader.get_more_samples();
if (!samples)
if (samples) {
printf("\033[u");
printf("%d/%d", loader.loaded_samples(), loader.total_samples());
fflush(stdout);
audio_client->enqueue(*samples);
} else if (audio_client->get_remaining_samples()) {
sleep(1);
} else {
break;
printf("\033[u");
printf("%d/%d", loader.loaded_samples(), loader.total_samples());
fflush(stdout);
audio_client->enqueue(*samples);
}
}
printf("\n");
return 0;