module-combine: always use last input buffer

To handle the case where buffers are queued up because a trigger didn't
complete.
This commit is contained in:
Wim Taymans 2023-06-16 11:31:13 +02:00
parent cfaf424ed8
commit b9789e36cd

View file

@ -965,8 +965,17 @@ static void combine_input_process(void *d)
struct stream *s;
bool delay_changed = false;
if ((in = pw_stream_dequeue_buffer(impl->combine)) == NULL) {
pw_log_debug("out of buffers: %m");
in = NULL;
while (true) {
struct pw_buffer *t;
if ((t = pw_stream_dequeue_buffer(impl->combine)) == NULL)
break;
if (in)
pw_stream_queue_buffer(impl->combine, in);
in = t;
}
if (in == NULL) {
pw_log_debug("%p: out of input buffers: %m", impl);
return;
}
@ -980,7 +989,7 @@ static void combine_input_process(void *d)
delay_changed = true;
if ((out = pw_stream_dequeue_buffer(s->stream)) == NULL) {
pw_log_warn("out of playback buffers: %m");
pw_log_warn("%p: out of playback buffers: %m", s);
goto do_trigger;
}
@ -1033,7 +1042,7 @@ static void combine_output_process(void *d)
bool delay_changed = false;
if ((out = pw_stream_dequeue_buffer(impl->combine)) == NULL) {
pw_log_debug("out of buffers: %m");
pw_log_debug("%p: out of output buffers: %m", impl);
return;
}
@ -1046,8 +1055,17 @@ static void combine_output_process(void *d)
if (check_stream_delay(s))
delay_changed = true;
if ((in = pw_stream_dequeue_buffer(s->stream)) == NULL) {
pw_log_warn("%p: out of capture buffers: %m", s);
in = NULL;
while (true) {
struct pw_buffer *t;
if ((t = pw_stream_dequeue_buffer(s->stream)) == NULL)
break;
if (in)
pw_stream_queue_buffer(s->stream, in);
in = t;
}
if (in == NULL) {
pw_log_debug("%p: out of input buffers: %m", s);
continue;
}
s->ready = false;