mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 23:45:26 +00:00
dummy backend: fix sometimes calling write_callback with 0 avail
This commit is contained in:
parent
c62c2e4661
commit
c3e3af2061
|
@ -21,6 +21,7 @@ static void playback_thread_run(void *arg) {
|
|||
int free_bytes = soundio_ring_buffer_capacity(&osd->ring_buffer) - fill_bytes;
|
||||
int free_frames = free_bytes / outstream->bytes_per_frame;
|
||||
osd->frames_left = free_frames;
|
||||
if (free_frames > 0)
|
||||
outstream->write_callback(outstream, 0, free_frames);
|
||||
double start_time = soundio_os_get_time();
|
||||
long frames_consumed = 0;
|
||||
|
@ -37,6 +38,7 @@ static void playback_thread_run(void *arg) {
|
|||
int free_bytes = soundio_ring_buffer_capacity(&osd->ring_buffer);
|
||||
int free_frames = free_bytes / outstream->bytes_per_frame;
|
||||
osd->frames_left = free_frames;
|
||||
if (free_frames > 0)
|
||||
outstream->write_callback(outstream, 0, free_frames);
|
||||
frames_consumed = 0;
|
||||
start_time = soundio_os_get_time();
|
||||
|
@ -59,6 +61,7 @@ static void playback_thread_run(void *arg) {
|
|||
if (frames_to_kill > fill_frames) {
|
||||
outstream->underflow_callback(outstream);
|
||||
osd->frames_left = free_frames;
|
||||
if (free_frames > 0)
|
||||
outstream->write_callback(outstream, 0, free_frames);
|
||||
frames_consumed = 0;
|
||||
start_time = soundio_os_get_time();
|
||||
|
|
Loading…
Reference in a new issue