Skip to content

Commit 0bc1215

Browse files
committed
acap/coreaudio: fix outputting empty frames
a race condition Prior to e511f898 (2024-11-14) and still in the stable branch, it produces: [Audio decompress] 2 empty channel(s) returned!
1 parent 19f19c3 commit 0bc1215

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/audio/capture/coreaudio.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,13 +413,13 @@ static void (^cb)(BOOL) = ^void(BOOL granted) {
413413
pthread_mutex_lock(&s->lock);
414414
ret = ring_buffer_read(s->buffer, s->frame.data, s->frame.max_size);
415415
if(!ret) {
416+
s->data_ready = FALSE;
416417
s->boss_waiting = TRUE;
417418
while(!s->data_ready) {
418419
pthread_cond_wait(&s->cv, &s->lock);
419420
}
420421
s->boss_waiting = FALSE;
421422
ret = ring_buffer_read(s->buffer, s->frame.data, s->frame.max_size);
422-
s->data_ready = FALSE;
423423
}
424424
pthread_mutex_unlock(&s->lock);
425425

0 commit comments

Comments
 (0)