remote: ask for input in start

This commit is contained in:
Wim Taymans 2017-10-27 18:13:48 +02:00
parent 61555ab3b5
commit f04b292d08

View file

@ -964,6 +964,24 @@ client_node_use_buffers(void *object,
} }
static void node_need_input(void *data)
{
struct node_data *d = data;
uint64_t cmd = 1;
pw_client_node_transport_add_message(d->trans,
&PW_CLIENT_NODE_MESSAGE_INIT(PW_CLIENT_NODE_MESSAGE_NEED_INPUT));
write(d->rtwritefd, &cmd, 8);
}
static void node_have_output(void *data)
{
struct node_data *d = data;
uint64_t cmd = 1;
pw_client_node_transport_add_message(d->trans,
&PW_CLIENT_NODE_MESSAGE_INIT(PW_CLIENT_NODE_MESSAGE_HAVE_OUTPUT));
write(d->rtwritefd, &cmd, 8);
}
static bool static bool
handle_node_command(struct pw_proxy *proxy, uint32_t seq, const struct spa_command *command) handle_node_command(struct pw_proxy *proxy, uint32_t seq, const struct spa_command *command)
{ {
@ -984,6 +1002,7 @@ handle_node_command(struct pw_proxy *proxy, uint32_t seq, const struct spa_comma
pw_client_node_proxy_done(data->node_proxy, seq, res); pw_client_node_proxy_done(data->node_proxy, seq, res);
} }
else if (SPA_COMMAND_TYPE(command) == remote->core->type.command_node.Start) { else if (SPA_COMMAND_TYPE(command) == remote->core->type.command_node.Start) {
int i;
pw_log_debug("node %p: start %d", proxy, seq); pw_log_debug("node %p: start %d", proxy, seq);
@ -994,6 +1013,12 @@ handle_node_command(struct pw_proxy *proxy, uint32_t seq, const struct spa_comma
if ((res = spa_node_send_command(data->node->node, command)) < 0) if ((res = spa_node_send_command(data->node->node, command)) < 0)
pw_log_warn("node %p: start failed", proxy); pw_log_warn("node %p: start failed", proxy);
/* FIXME we should call process_output on the node and see what its
* status is */
for (i = 0; i < data->trans->area->max_input_ports; i++)
data->trans->inputs[i].status = SPA_RESULT_NEED_BUFFER;
node_need_input(data);
pw_client_node_proxy_done(data->node_proxy, seq, res); pw_client_node_proxy_done(data->node_proxy, seq, res);
} }
else if (SPA_COMMAND_TYPE(command) == remote->core->type.command_node.ClockUpdate) { else if (SPA_COMMAND_TYPE(command) == remote->core->type.command_node.ClockUpdate) {
@ -1050,24 +1075,6 @@ static const struct pw_client_node_proxy_events client_node_events = {
.port_command = client_node_port_command, .port_command = client_node_port_command,
}; };
static void node_need_input(void *data)
{
struct node_data *d = data;
uint64_t cmd = 1;
pw_client_node_transport_add_message(d->trans,
&PW_CLIENT_NODE_MESSAGE_INIT(PW_CLIENT_NODE_MESSAGE_NEED_INPUT));
write(d->rtwritefd, &cmd, 8);
}
static void node_have_output(void *data)
{
struct node_data *d = data;
uint64_t cmd = 1;
pw_client_node_transport_add_message(d->trans,
&PW_CLIENT_NODE_MESSAGE_INIT(PW_CLIENT_NODE_MESSAGE_HAVE_OUTPUT));
write(d->rtwritefd, &cmd, 8);
}
static void do_node_init(struct pw_proxy *proxy) static void do_node_init(struct pw_proxy *proxy)
{ {
struct node_data *data = proxy->user_data; struct node_data *data = proxy->user_data;