summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-03-11 12:35:04 +0100
committerWim Taymans <wtaymans@redhat.com>2019-03-11 12:35:04 +0100
commit32817371999ffe07a6b9d5b65179fd06cb1262cb (patch)
tree50040d026b8d6b53f01ed64f63230ea3fcea3f9b
parent317493a2dc558cd371610496f8d49a10f2466fa6 (diff)
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.
-rw-r--r--src/gst/gstpipewiresrc.c1
-rw-r--r--src/pipewire/link.c5
-rw-r--r--src/pipewire/port.h1
-rw-r--r--src/pipewire/private.h3
4 files changed, 5 insertions, 5 deletions
diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c
index 0200fc50..08483805 100644
--- a/src/gst/gstpipewiresrc.c
+++ b/src/gst/gstpipewiresrc.c
@@ -430,7 +430,6 @@ on_process (void *_data)
mem->offset += data->offset;
}
-
gst_buffer_ref (buf);
g_queue_push_tail (&pwsrc->queue, buf);
diff --git a/src/pipewire/link.c b/src/pipewire/link.c
index 24573e64..fbae8eca 100644
--- a/src/pipewire/link.c
+++ b/src/pipewire/link.c
@@ -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);
}
diff --git a/src/pipewire/port.h b/src/pipewire/port.h
index 6994fcd1..ffb18d82 100644
--- a/src/pipewire/port.h
+++ b/src/pipewire/port.h
@@ -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 */
diff --git a/src/pipewire/private.h b/src/pipewire/private.h
index 133548de..2ec00b8e 100644
--- a/src/pipewire/private.h
+++ b/src/pipewire/private.h
@@ -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;