stream: emit new_buffer only if HAVE_BUFFER

Emit the new_buffer event only if the IO area status is HAVE_BUFFER.

In client-reuse mode, also clear the buffer ID - we need an explicit
recycle call before recycling.

Change-Id: I139663068ef12669adc13b7e351666c8469dee72
This commit is contained in:
David Svensson Fors 2017-10-27 13:22:30 +02:00 committed by Wim Taymans
parent ff242550c8
commit 82eaf7e8dd

View file

@ -529,7 +529,6 @@ static void handle_rtnode_message(struct pw_stream *stream, struct pw_client_nod
uint32_t buffer_id;
buffer_id = input->buffer_id;
input->status = SPA_RESULT_NEED_BUFFER;
pw_log_trace("stream %p: process input %d %d", stream, input->status,
buffer_id);
@ -537,9 +536,16 @@ static void handle_rtnode_message(struct pw_stream *stream, struct pw_client_nod
if ((bid = find_buffer(stream, buffer_id)) == NULL)
continue;
bid->used = true;
spa_hook_list_call(&stream->listener_list, struct pw_stream_events,
if (impl->client_reuse)
input->buffer_id = SPA_ID_INVALID;
if (input->status == SPA_RESULT_HAVE_BUFFER) {
bid->used = true;
spa_hook_list_call(&stream->listener_list, struct pw_stream_events,
new_buffer, buffer_id);
}
input->status = SPA_RESULT_NEED_BUFFER;
}
send_need_input(stream);
} else if (PW_CLIENT_NODE_MESSAGE_TYPE(message) == PW_CLIENT_NODE_MESSAGE_PROCESS_OUTPUT) {