mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
libcamera: Fixed the crash issue when rtkit is enabled.
This commit is contained in:
parent
2c70106728
commit
40ef322a34
4 changed files with 46 additions and 32 deletions
|
|
@ -579,10 +579,6 @@ static int mmap_read(struct impl *this)
|
|||
uint32_t bytesused;
|
||||
|
||||
if(dev->camera) {
|
||||
if(!libcamera_is_data_available(dev->camera)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
pOut = (struct OutBuf *)libcamera_get_ring_buffer_data(dev->camera);
|
||||
if(!pOut) {
|
||||
spa_log_debug(this->log, "Exiting %s as pOut is NULL\n", __FUNCTION__);
|
||||
|
|
@ -672,6 +668,7 @@ static void libcamera_on_fd_events(struct spa_source *source)
|
|||
struct spa_io_buffers *io;
|
||||
struct port *port = &this->out_ports[0];
|
||||
struct buffer *b;
|
||||
uint64_t cnt;
|
||||
|
||||
if (source->rmask & SPA_IO_ERR) {
|
||||
struct port *port = &this->out_ports[0];
|
||||
|
|
@ -685,6 +682,11 @@ static void libcamera_on_fd_events(struct spa_source *source)
|
|||
spa_log_warn(this->log, "libcamera %p: spurious wakeup %d", this, source->rmask);
|
||||
return;
|
||||
}
|
||||
|
||||
if (spa_system_eventfd_read(this->system, port->source.fd, &cnt) < 0) {
|
||||
spa_log_error(this->log, "Failed to read on event fd");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mmap_read(this) < 0) {
|
||||
spa_log_debug(this->log, "%s:: mmap_read failure\n", __FUNCTION__);
|
||||
|
|
@ -911,10 +913,18 @@ static int spa_libcamera_stream_on(struct impl *this)
|
|||
|
||||
port->source.func = libcamera_on_fd_events;
|
||||
port->source.data = this;
|
||||
port->source.fd = get_dev_fd(dev);
|
||||
port->source.fd = spa_system_eventfd_create(this->system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK);
|
||||
port->source.mask = SPA_IO_IN | SPA_IO_ERR;
|
||||
port->source.rmask = 0;
|
||||
spa_loop_add_source(this->data_loop, &port->source);
|
||||
if (port->source.fd < 0) {
|
||||
spa_log_error(this->log, "Failed to create eventfd. Exting %s with -EIO\n", __FUNCTION__);
|
||||
} else {
|
||||
spa_loop_add_source(this->data_loop, &port->source);
|
||||
this->have_source = true;
|
||||
|
||||
libcamera_set_spa_system(dev->camera, this->system);
|
||||
libcamera_set_eventfd(dev->camera, port->source.fd);
|
||||
}
|
||||
|
||||
dev->active = true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue