module-rtp: handle state change errors better

Make a new function to set the rtp stream in the error state.

When we fail to start the stream, set the error state. Otherwise (like
when we try to use an invalid interface name) the socket create will
fail but the stream will still try to send data to the invalid socket.
This commit is contained in:
Wim Taymans 2024-03-25 12:22:11 +01:00
parent 6e7b893448
commit 4ffd74ef46
4 changed files with 14 additions and 3 deletions

View file

@ -307,6 +307,7 @@ static void stream_state_changed(void *data, bool started, const char *error)
impl->mcast_loop, impl->ttl, impl->dscp,
impl->ifname)) < 0) {
pw_log_error("can't make socket: %s", spa_strerror(res));
rtp_stream_set_error(impl->stream, res, "Can't make socket");
return;
}
impl->rtp_fd = res;