link: keep per link buffer negotiation state

Keep buffers cached on output ports.
Complete the link to PAUSED when we have negotiated buffers on
input and output.
This commit is contained in:
Wim Taymans 2019-03-11 12:35:04 +01:00
parent 317493a2dc
commit 3281737199
4 changed files with 5 additions and 5 deletions

View file

@ -430,7 +430,6 @@ on_process (void *_data)
mem->offset += data->offset;
}
gst_buffer_ref (buf);
g_queue_push_tail (&pwsrc->queue, buf);

View file

@ -175,13 +175,14 @@ static void complete_paused(void *obj, void *data, int res, uint32_t id)
if (SPA_RESULT_IS_OK(res)) {
pw_port_update_state(port, PW_PORT_STATE_PAUSED);
mix->have_buffers = true;
pw_log_debug("port %p: state PAUSED", port);
} else {
pw_port_update_state(port, PW_PORT_STATE_ERROR);
mix->have_buffers = false;
pw_log_warn("port %p: failed to go to PAUSED", port);
}
if (this->input->state >= PW_PORT_STATE_PAUSED &&
this->output->state >= PW_PORT_STATE_PAUSED)
if (this->rt.in_mix.have_buffers && this->rt.out_mix.have_buffers)
pw_link_update_state(this, PW_LINK_STATE_PAUSED, NULL);
}

View file

@ -55,7 +55,6 @@ enum pw_port_state {
PW_PORT_STATE_CONFIGURE = 1, /**< the port is ready for format negotiation */
PW_PORT_STATE_READY = 2, /**< the port is ready for buffer allocation */
PW_PORT_STATE_PAUSED = 3, /**< the port is paused */
PW_PORT_STATE_STREAMING = 4, /**< the port is streaming */
};
/** Port events, use \ref pw_port_add_listener */

View file

@ -427,6 +427,7 @@ struct pw_port_mix {
} port;
struct spa_io_buffers *io;
uint32_t id;
int have_buffers;
};
struct pw_port_implementation {
@ -537,7 +538,7 @@ struct pw_link {
struct {
struct pw_port_mix out_mix; /**< port added to the output mixer */
struct pw_port_mix in_mix; /**< port added to the input mixer */
struct pw_node_target target;
struct pw_node_target target; /**< target to trigger the input node */
} rt;
void *user_data;