mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13: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:
parent
406aabff23
commit
02e787f8a4
Notes:
sideshowbarker
2024-07-19 11:37:55 +09:00
Author: https://github.com/tlmrgvf
Commit: 02e787f8a4
Pull-request: https://github.com/SerenityOS/serenity/pull/672
1 changed files with 9 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue