mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
stream: handle the case where io is NULL
Some older servers set the io area after starting the node and so the node runs first without io areas, just return an error instead of crashing. Fixes #2964
This commit is contained in:
parent
1126fbd26c
commit
cb8d9f38b2
1 changed files with 12 additions and 3 deletions
|
|
@ -636,8 +636,10 @@ static int impl_send_command(void *object, const struct spa_command *command)
|
|||
if (stream->state == PW_STREAM_STATE_PAUSED) {
|
||||
pw_log_debug("%p: start %d", stream, impl->direction);
|
||||
|
||||
if (impl->direction == SPA_DIRECTION_INPUT)
|
||||
if (impl->direction == SPA_DIRECTION_INPUT) {
|
||||
if (impl->io != NULL)
|
||||
impl->io->status = SPA_STATUS_NEED_DATA;
|
||||
}
|
||||
else if (!impl->process_rt && !impl->driving) {
|
||||
copy_position(impl, impl->queued.incount);
|
||||
call_process(impl);
|
||||
|
|
@ -997,6 +999,9 @@ static int impl_node_process_input(void *object)
|
|||
struct spa_io_buffers *io = impl->io;
|
||||
struct buffer *b;
|
||||
|
||||
if (io == NULL)
|
||||
return -EIO;
|
||||
|
||||
pw_log_trace_fp("%p: process in status:%d id:%d ticks:%"PRIu64" delay:%"PRIi64,
|
||||
stream, io->status, io->buffer_id, impl->time.ticks, impl->time.delay);
|
||||
|
||||
|
|
@ -1037,6 +1042,9 @@ static int impl_node_process_output(void *object)
|
|||
int res;
|
||||
bool ask_more;
|
||||
|
||||
if (io == NULL)
|
||||
return -EIO;
|
||||
|
||||
again:
|
||||
pw_log_trace_fp("%p: process out status:%d id:%d", stream,
|
||||
io->status, io->buffer_id);
|
||||
|
|
@ -1396,6 +1404,7 @@ static void context_drained(void *data, struct pw_impl_node *node)
|
|||
return;
|
||||
if (impl->draining && impl->drained) {
|
||||
impl->draining = false;
|
||||
if (impl->io != NULL)
|
||||
impl->io->status = SPA_STATUS_NEED_DATA;
|
||||
call_drained(impl);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue